pub trait Renderable {
// Required method
fn render(&self, options: &ConsoleOptions) -> RenderResult;
// Provided method
fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement> { ... }
}Expand description
Trait for anything that can be rendered to the console.
Equivalent to __rich_console__ in Python Rich.
Required Methods§
Sourcefn render(&self, options: &ConsoleOptions) -> RenderResult
fn render(&self, options: &ConsoleOptions) -> RenderResult
Render this object into a RenderResult using the provided options.
Implementing types produce Segments or nested Renderables
that are recursively flattened by Console::render.
Provided Methods§
Sourcefn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
fn measure(&self, _options: &ConsoleOptions) -> Option<Measurement>
Optional width-measurement hook (equivalent to __rich_measure__).
Override to provide min/max width constraints for layout.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Renderable for &str
Allows a &str to be used as a renderable (rendered as plain text).
impl Renderable for &str
Allows a &str to be used as a renderable (rendered as plain text).
fn render(&self, _options: &ConsoleOptions) -> RenderResult
Source§impl Renderable for String
Allows a String to be used as a renderable.
impl Renderable for String
Allows a String to be used as a renderable.
fn render(&self, options: &ConsoleOptions) -> RenderResult
Implementors§
impl Renderable for BarChart
impl Renderable for Columns
impl Renderable for Constrain
impl Renderable for DynRenderable
Delegates rendering to the inner trait object.
impl Renderable for FileProxy
impl Renderable for Group
Renders each child sequentially and concatenates their output lines.
impl Renderable for Inspect
impl Renderable for JsonRender
impl Renderable for Lines
impl Renderable for LogRecord
impl Renderable for LogTable
impl Renderable for MarkdownRender
impl Renderable for NewLine
impl Renderable for NoChange
impl Renderable for Padding
impl Renderable for Panel
impl Renderable for Pretty
impl Renderable for Renderables
impl Renderable for Rule
impl Renderable for Screen
impl Renderable for Styled
impl Renderable for Syntax
impl Renderable for Table
impl Renderable for Text
Allows a Text object to be used as a renderable.