pub struct ListState {
pub selected: Option<usize>,
/* private fields */
}
Fields§
§selected: Option<usize>
The selected item. If None
, no item is currently selected.
Implementations§
Source§impl ListState
impl ListState
Sourcepub fn selected(&self) -> Option<usize>
👎Deprecated since 0.9.0: Use ListState’s selected field instead.
pub fn selected(&self) -> Option<usize>
Returns the index of the currently selected item, if any.
Sourcepub fn next(&mut self)
pub fn next(&mut self)
Selects the next element of the list. If circular is true, calling next on the last element selects the first.
§Example
use tui_widget_list::ListState;
let mut list_state = ListState::default();
list_state.next();
Sourcepub fn previous(&mut self)
pub fn previous(&mut self)
Selects the previous element of the list. If circular is true, calling previous on the first element selects the last.
§Example
use tui_widget_list::ListState;
let mut list_state = ListState::default();
list_state.previous();
Sourcepub fn scroll_offset_index(&self) -> usize
pub fn scroll_offset_index(&self) -> usize
Returns the index of the first item currently displayed on the screen.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ListState
impl RefUnwindSafe for ListState
impl Send for ListState
impl Sync for ListState
impl Unpin for ListState
impl UnwindSafe for ListState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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