Skip to main content

Renderable

Trait Renderable 

Source
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§

Source

fn render(&self, options: &ConsoleOptions) -> RenderResult

Provided Methods§

Source

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

Source§

fn render(&self, _options: &ConsoleOptions) -> RenderResult

Source§

impl Renderable for String

Implementors§