pub trait Widget: Any {
// Required methods
fn render(&self, buffer: &mut Buffer, rect: Rect, cache: &mut Cache);
fn height(&self, size: &Vec2) -> usize;
fn width(&self, size: &Vec2) -> usize;
// Provided method
fn children(&self) -> Vec<&Element> { ... }
}Expand description
Trait implemented by all the widgets. Trait implemented by all the widgets.
A widget is a visual component that can render itself to a Buffer and
report its size requirements for layout purposes.
Use Element to store and manipulate widgets in a uniform way.
Users will use Widget trait directly only when implementing custom
widget, otherwise they will use built-in widgets like [Span], [List]
and so on.
Required Methods§
Provided Methods§
Implementations§
Trait Implementations§
Source§impl From<ProgressBar> for Box<dyn Widget>
impl From<ProgressBar> for Box<dyn Widget>
Source§fn from(value: ProgressBar) -> Self
fn from(value: ProgressBar) -> Self
Converts to this type from the input type.
Source§impl<W> From<Scrollable<W>> for Box<dyn Widget>where
W: Widget + 'static,
impl<W> From<Scrollable<W>> for Box<dyn Widget>where
W: Widget + 'static,
Source§fn from(value: Scrollable<W>) -> Self
fn from(value: Scrollable<W>) -> Self
Converts to this type from the input type.