pub trait Component: Send + Sync {
// Required methods
fn render(&self, width: usize) -> Vec<String>;
fn invalidate(&self);
fn as_any(&self) -> &dyn Any;
// Provided methods
fn handle_input(&self, _data: &str) -> bool { ... }
fn wants_key_release(&self) -> bool { ... }
}Expand description
Component interface - all components must implement this.
Components are the building blocks of the TUI. Each component can render itself to a list of strings (one per line) for a given viewport width.
Required Methods§
Sourcefn invalidate(&self)
fn invalidate(&self)
Invalidate any cached rendering state. Called when theme changes or when component needs to re-render from scratch.
Provided Methods§
Sourcefn handle_input(&self, _data: &str) -> bool
fn handle_input(&self, _data: &str) -> bool
Sourcefn wants_key_release(&self) -> bool
fn wants_key_release(&self) -> bool
If true, component receives key release events (Kitty protocol). Default is false - release events are filtered out.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".