Skip to main content

Widget

Trait Widget 

Source
pub trait Widget {
    // Required method
    fn create_graphemes(&self) -> CreatedGraphemes;

    // Provided method
    fn create_graphemes_in_viewport(
        &self,
        _width: u16,
        _height: u16,
    ) -> CreatedGraphemes { ... }
}
Expand description

Projects widget state into width-independent styled content.

Required Methods§

Source

fn create_graphemes(&self) -> CreatedGraphemes

Creates the widget’s complete content.

Provided Methods§

Source

fn create_graphemes_in_viewport( &self, _width: u16, _height: u16, ) -> CreatedGraphemes

Creates content bounded by a terminal viewport.

The default implementation returns the complete content. Large widgets can override this method to avoid projecting rows that cannot be shown. Wrapping and truncation remain the renderer’s responsibility.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§