Skip to main content

plain

Function plain 

Source
pub fn plain(view: impl Into<View>, cols: usize) -> String
Expand description

Renders a message-free view or builder as plain text cols columns wide (rules span it; text isn’t wrapped). Lines end with \n.

§Example

use tern_sdk::ui::{self, View};

let view: View = View::new().main([ui::progress().value(0.5).label("half")]);
assert_eq!(tern_sdk::plain(view, 80), "[#####-----] 50% half\n");
assert_eq!(tern_sdk::plain(ui::text("hello"), 80), "hello\n");