pub struct RenderResult {
pub lines: Vec<Vec<Segment>>,
pub items: Vec<RenderItem>,
}Expand description
The result of rendering: a list of lines, each line being a list of
segments. Also carries an optional items list for recursive rendering.
Fields§
§lines: Vec<Vec<Segment>>Flat line-oriented segments (backward-compatible).
items: Vec<RenderItem>Optional render items for recursive flattening. When present,
Console::render() recurses into nested renderables.
Implementations§
Source§impl RenderResult
impl RenderResult
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty RenderResult.
Sourcepub fn from_text(text: &str) -> Self
pub fn from_text(text: &str) -> Self
Create a RenderResult from a plain text string.
The text becomes a single line with one segment.
Sourcepub fn from_segments(segments: Vec<Segment>) -> Self
pub fn from_segments(segments: Vec<Segment>) -> Self
Create a RenderResult from a list of Segments on a single line.
Sourcepub fn from_lines(lines: Vec<Vec<Segment>>) -> Self
pub fn from_lines(lines: Vec<Vec<Segment>>) -> Self
Create a RenderResult from pre-computed lines of Segments.
Sourcepub fn from_items(items: Vec<RenderItem>) -> Self
pub fn from_items(items: Vec<RenderItem>) -> Self
Create a RenderResult from RenderItems for recursive flattening.
Sourcepub fn push_item(&mut self, item: impl Into<RenderItem>)
pub fn push_item(&mut self, item: impl Into<RenderItem>)
Push a segment item.
Sourcepub fn push_renderable(&mut self, r: impl Renderable + Send + Sync + 'static)
pub fn push_renderable(&mut self, r: impl Renderable + Send + Sync + 'static)
Push a nested renderable for recursive flattening.
Sourcepub fn flatten(&self, options: &ConsoleOptions) -> Vec<Segment>
pub fn flatten(&self, options: &ConsoleOptions) -> Vec<Segment>
Recursively flatten items into segments using the given options.
This is called by Console::render() to resolve nested renderables.
Trait Implementations§
Source§impl Clone for RenderResult
impl Clone for RenderResult
Source§fn clone(&self) -> RenderResult
fn clone(&self) -> RenderResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more