pub struct Listbox(/* private fields */);listbox only.Expand description
A Listbox struct that encapsulates a list of strings,
allowing for navigation and manipulation through a cursor.
It supports basic operations
such as moving the cursor forward and backward,
retrieving the current item,
and initializing from an iterator of displayable items.
Implementations§
Source§impl Listbox
impl Listbox
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn push_string(&mut self, item: String)
Sourcepub fn from_styled_graphemes(items: Vec<StyledGraphemes>) -> Self
pub fn from_styled_graphemes(items: Vec<StyledGraphemes>) -> Self
Creates a new Listbox from a vector of StyledGraphemes.
Sourcepub fn items(&self) -> &Vec<StyledGraphemes>
pub fn items(&self) -> &Vec<StyledGraphemes>
Returns a reference to the vector of items in the listbox.
Sourcepub fn get(&self) -> StyledGraphemes
pub fn get(&self) -> StyledGraphemes
Retrieves the item at the current cursor position as a String.
If the cursor is at a position without an item,
returns an empty String.
Sourcepub fn backward(&mut self) -> bool
pub fn backward(&mut self) -> bool
Moves the cursor backward in the listbox, if possible.
Returns true if the cursor was successfully moved backward, false otherwise.
Sourcepub fn forward(&mut self) -> bool
pub fn forward(&mut self) -> bool
Moves the cursor forward in the listbox, if possible.
Returns true if the cursor was successfully moved forward, false otherwise.
Sourcepub fn move_to_head(&mut self)
pub fn move_to_head(&mut self)
Moves the cursor to the head (beginning) of the listbox.
Sourcepub fn move_to_tail(&mut self)
pub fn move_to_tail(&mut self)
Moves the cursor to the tail of the listbox.
pub fn is_tail(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Listbox
impl RefUnwindSafe for Listbox
impl Send for Listbox
impl Sync for Listbox
impl Unpin for Listbox
impl UnsafeUnpin for Listbox
impl UnwindSafe for Listbox
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
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>
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