pub trait Renderable {
// Required methods
fn measure(&self, context: &Context) -> Measurement;
fn render(&self, context: &Context) -> Vec<Line>;
}Expand description
Content that knows its own size and can draw itself at a width.
A container asks each child to measure, decides the
child’s width, and renders the child at that width. The trait is dyn
compatible, so a container can hold Box<dyn Renderable>. A reference to a
widget and a Box of one are widgets too, so a container can borrow its
children.
The ctl_text crate docs show a complete widget.
Required Methods§
Sourcefn measure(&self, context: &Context) -> Measurement
fn measure(&self, context: &Context) -> Measurement
The narrowest and widest this content can usefully be.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".