Skip to main content

RenderItem

Trait RenderItem 

Source
pub trait RenderItem {
    // Required method
    fn render(
        &self,
        area: Rect,
        frame: &mut Frame<'_>,
        selected: bool,
        skip_rows: u16,
    );

    // Provided method
    fn height(&self) -> u16 { ... }
}
Expand description

Trait for items that can render themselves.

Implement this trait for item types that should render in a VirtualizedList.

Required Methods§

Source

fn render( &self, area: Rect, frame: &mut Frame<'_>, selected: bool, skip_rows: u16, )

Render the item into the frame at the given area.

§Arguments
  • area - The area to render into.
  • frame - The frame to render into.
  • selected - Whether the item is selected.
  • skip_rows - Number of rows to skip from the top of the item content. This is non-zero when the item partially overlaps the top of the viewport.

Provided Methods§

Source

fn height(&self) -> u16

Height of this item in terminal rows.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RenderItem for &str

Source§

fn render( &self, area: Rect, frame: &mut Frame<'_>, _selected: bool, skip_rows: u16, )

Source§

impl RenderItem for String

Source§

fn render( &self, area: Rect, frame: &mut Frame<'_>, _selected: bool, skip_rows: u16, )

Implementors§