pub struct ListView { /* private fields */ }Expand description
Scrollable item list with keyboard selection.
Implementations§
Source§impl ListView
impl ListView
pub fn new(items: Vec<String>, visible_count: usize) -> Self
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Move selection down by one, scrolling if needed.
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Move selection up by one, scrolling if needed.
Sourcepub fn select_first(&mut self)
pub fn select_first(&mut self)
Jump to the first item.
Sourcepub fn select_last(&mut self)
pub fn select_last(&mut self)
Jump to the last item.
Sourcepub fn selected_item(&self) -> Option<&str>
pub fn selected_item(&self) -> Option<&str>
Returns the currently selected item, if any.
Sourcepub fn visible_items(&self) -> &[String]
pub fn visible_items(&self) -> &[String]
Returns the slice of items currently visible in the viewport.
Sourcepub fn set_items(&mut self, items: Vec<String>)
pub fn set_items(&mut self, items: Vec<String>)
Replace all items and reset selection to first.
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Returns the current selected index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ListView
impl RefUnwindSafe for ListView
impl Send for ListView
impl Sync for ListView
impl Unpin for ListView
impl UnsafeUnpin for ListView
impl UnwindSafe for ListView
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
Mutably borrows from an owned value. Read more