summaryrefslogtreecommitdiffstats
path: root/src/client/tui.rs
blob: 9a4e4dae159483f06f462f9b0171aba301318fa9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Text rendering for the terminal adapter.
//!
//! This is the TUI's half of the `View` boundary: the GUI renders the same
//! data with a painter instead of strings.

use crate::client::games::roulette::RouletteGame;
use crate::client::view::View;

/// Render any view to terminal lines.
pub fn render_view(view: &View) -> Vec<String> {
    match view {
        View::Roulette(roulette) => RouletteGame::render_view(roulette)
            .lines()
            .map(str::to_string)
            .collect(),
        View::Text(lines) => lines.clone(),
    }
}