pub struct PickerState {
pub search: String,
pub selected: usize,
pub scroll_offset: usize,
}Expand description
Navigation and search state for a render_picker widget.
Fields§
§search: StringCurrent search string (shown in the search box).
selected: usizeIndex of the selected item in the filtered list.
scroll_offset: usizeFirst visible item index (scroll offset).
Implementations§
Source§impl PickerState
impl PickerState
pub fn new() -> Self
Sourcepub fn select_next(&mut self, item_count: usize)
pub fn select_next(&mut self, item_count: usize)
Move selection down by one, clamped to item_count.
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Move selection up by one.
Sourcepub fn reset_selection(&mut self)
pub fn reset_selection(&mut self)
Reset selection and scroll when the search changes.
Sourcepub fn clamp_scroll(&mut self, visible_height: usize)
pub fn clamp_scroll(&mut self, visible_height: usize)
Clamp scroll so the selected row is always visible.
Trait Implementations§
Source§impl Clone for PickerState
impl Clone for PickerState
Source§fn clone(&self) -> PickerState
fn clone(&self) -> PickerState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PickerState
impl Debug for PickerState
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> 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