pub struct ListView<'a> { /* private fields */ }Expand description
Rows drawn against a SelectionState, with the chrome every list pane in
the UI puts around one: an optional border, an optional scrollbar, and a
placeholder for when there is nothing to show.
Only the rows on screen are built, so the pickers that index a whole working tree cost a screenful of work per frame rather than one row per entry.
Rows are fitted to the columns actually left over here, so callers building them never work out how much the border, highlight symbol, and scrollbar take. Rendering records where the rows landed, so a later click can be hit-tested against the same area they were drawn into.
Implementations§
Source§impl<'a> ListView<'a>
impl<'a> ListView<'a>
Sourcepub fn new(rows: Vec<Line<'static>>, theme: &'a Theme) -> Self
pub fn new(rows: Vec<Line<'static>>, theme: &'a Theme) -> Self
Rows already in hand, for the lists short enough that building them all costs nothing.
Sourcepub fn lazy(
len: usize,
row: impl FnMut(usize) -> Line<'static> + 'a,
theme: &'a Theme,
) -> Self
pub fn lazy( len: usize, row: impl FnMut(usize) -> Line<'static> + 'a, theme: &'a Theme, ) -> Self
len rows, each built by row only if it is drawn.
Sourcepub fn empty_message(self, message: &'a str) -> Self
pub fn empty_message(self, message: &'a str) -> Self
Shown in place of the rows when there are none.
pub fn block(self, block: Block<'static>) -> Self
Sourcepub fn bordered(self, title: impl Into<String>) -> Self
pub fn bordered(self, title: impl Into<String>) -> Self
Wraps the list in a titled border, the standard full-pane picker chrome.
pub fn pane(self, empty_message: &'a str) -> Self
Sourcepub fn scrollbar(self) -> Self
pub fn scrollbar(self) -> Self
Reserves the rightmost column for a scrollbar, so the track never sits on top of the rows.
pub fn highlight_style(self, style: Style) -> Self
pub fn highlight_symbol(self, symbol: &'static str) -> Self
pub fn highlight_horizontal_padding(self, padding: u16) -> Self
Trait Implementations§
Source§impl StatefulWidget for ListView<'_>
impl StatefulWidget for ListView<'_>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ListView<'a>
impl<'a> !Send for ListView<'a>
impl<'a> !Sync for ListView<'a>
impl<'a> !UnwindSafe for ListView<'a>
impl<'a> Freeze for ListView<'a>
impl<'a> Unpin for ListView<'a>
impl<'a> UnsafeUnpin for ListView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more