pub struct PickerState {
pub input_state: TextState<'static>,
pub prompt_text: Cow<'static, str>,
/* private fields */
}Expand description
State of the picker component
Fields§
§input_state: TextState<'static>Current input pattern
prompt_text: Cow<'static, str>Prompt text to display
Implementations§
Source§impl PickerState
impl PickerState
Sourcepub fn new(
prompt: impl Into<Cow<'static, str>>,
items: Vec<PickerItem>,
allow_custom_input: bool,
) -> Self
pub fn new( prompt: impl Into<Cow<'static, str>>, items: Vec<PickerItem>, allow_custom_input: bool, ) -> Self
Create a new picker with items
Sourcepub fn update_filter(&mut self)
pub fn update_filter(&mut self)
Update the filter based on current input pattern
Sourcepub fn selected(&self) -> Option<&PickerItem>
pub fn selected(&self) -> Option<&PickerItem>
Get the currently selected item, if any
Sourcepub fn filtered_items(&self) -> impl Iterator<Item = (usize, &PickerItem)>
pub fn filtered_items(&self) -> impl Iterator<Item = (usize, &PickerItem)>
Get all filtered items with their original indices Custom input item (if present) is always last with index usize::MAX
Sourcepub fn total_items(&self) -> usize
pub fn total_items(&self) -> usize
Get total number of items
Sourcepub fn filtered_count(&self) -> usize
pub fn filtered_count(&self) -> usize
Get number of filtered items
Sourcepub fn match_indices(&self, item_index: usize) -> Option<Vec<usize>>
pub fn match_indices(&self, item_index: usize) -> Option<Vec<usize>>
Get the fuzzy match positions for a given item (for highlighting)
Sourcepub fn status(&self) -> &PickerStatus
pub fn status(&self) -> &PickerStatus
Get current status
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if picker is cancelled
Auto Trait Implementations§
impl !Freeze for PickerState
impl RefUnwindSafe for PickerState
impl Send for PickerState
impl Sync for PickerState
impl Unpin for PickerState
impl UnsafeUnpin for PickerState
impl UnwindSafe for PickerState
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