pub struct SelectList<T> { /* private fields */ }Expand description
Single-selection list widget (arrow keys + Enter).
Implementations§
Source§impl<T: Display + Clone> SelectList<T>
impl<T: Display + Clone> SelectList<T>
pub fn new(label: impl Into<String>, items: Vec<T>) -> Self
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Index of the currently highlighted item.
Sourcepub fn selected_item(&self) -> Option<&T>
pub fn selected_item(&self) -> Option<&T>
Reference to the currently highlighted item, if any.
Sourcepub fn with_selected(self, idx: usize) -> Self
pub fn with_selected(self, idx: usize) -> Self
Builder: set the initial selection index.
Sourcepub fn items_mut(&mut self) -> &mut Vec<T>
pub fn items_mut(&mut self) -> &mut Vec<T>
Mutable reference to items, for updating status in place.
Sourcepub fn set_selected(&mut self, idx: usize)
pub fn set_selected(&mut self, idx: usize)
Set the selected index (clamped to bounds).
Sourcepub fn clamp_selected(&mut self)
pub fn clamp_selected(&mut self)
Clamp the selected index to be within bounds after items are removed.
pub fn handle_key(&mut self, key: &KeyPress) -> WidgetResult<T>
Auto Trait Implementations§
impl<T> Freeze for SelectList<T>
impl<T> RefUnwindSafe for SelectList<T>where
T: RefUnwindSafe,
impl<T> Send for SelectList<T>where
T: Send,
impl<T> Sync for SelectList<T>where
T: Sync,
impl<T> Unpin for SelectList<T>where
T: Unpin,
impl<T> UnsafeUnpin for SelectList<T>
impl<T> UnwindSafe for SelectList<T>where
T: UnwindSafe,
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> 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