CustomListItem

Trait CustomListItem 

Source
pub trait CustomListItem {
    type Widget<'w>: Widget + 'w
       where Self: 'w;

    // Required method
    fn as_widget<'a>(
        &'a self,
        theme: &Theme,
        inline: bool,
        is_highlighted: bool,
        is_discarded: bool,
    ) -> (Self::Widget<'a>, Size);
}
Expand description

A trait for types that can be rendered inside a CustomList

Required Associated Types§

Source

type Widget<'w>: Widget + 'w where Self: 'w

Required Methods§

Source

fn as_widget<'a>( &'a self, theme: &Theme, inline: bool, is_highlighted: bool, is_discarded: bool, ) -> (Self::Widget<'a>, Size)

Converts the item into a ratatui widget and its size

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CustomListItem for str

Source§

type Widget<'w> = Line<'w>

Source§

fn as_widget<'a>( &'a self, theme: &Theme, _inline: bool, is_highlighted: bool, is_discarded: bool, ) -> (Self::Widget<'a>, Size)

Source§

impl CustomListItem for String

Source§

type Widget<'w> = Line<'w>

Source§

fn as_widget<'a>( &'a self, theme: &Theme, inline: bool, is_highlighted: bool, is_discarded: bool, ) -> (Self::Widget<'a>, Size)

Implementors§