pub trait Widget {
// Required method
fn render(&self, area: Rect, buf: &mut Buffer);
// Provided methods
fn focusable(&self) -> bool { ... }
fn height_hint(&self, _width: u16) -> Option<u16> { ... }
fn width_hint(&self) -> Option<u16> { ... }
}Expand description
Trait for custom character-cell widgets.
Implement this trait to create widgets that render directly to the
terminal buffer. Use View::custom() to wrap your widget in a View.
Required Methods§
Provided Methods§
Sourcefn height_hint(&self, _width: u16) -> Option<u16>
fn height_hint(&self, _width: u16) -> Option<u16>
Hint for the widget’s preferred height given a width. Returns None if the widget has no preferred height.
Sourcefn width_hint(&self) -> Option<u16>
fn width_hint(&self) -> Option<u16>
Hint for the widget’s preferred width. Returns None if the widget has no preferred width.