pub struct SearchableList {
pub input: TextInput,
pub filtered: Vec<(usize, i64)>,
pub selected: Option<usize>,
pub scroll_offset: usize,
}Expand description
Shared state for any searchable, filterable list. Eliminates the mode-dispatch triplication for search/cursor/movement.
Fields§
§input: TextInput§filtered: Vec<(usize, i64)>Index-score pairs, sorted by score descending
selected: Option<usize>§scroll_offset: usizeImplementations§
Source§impl SearchableList
impl SearchableList
pub fn new(item_count: usize) -> Self
pub fn reset(&mut self, item_count: usize)
Sourcepub fn move_selection(&mut self, delta: i32)
pub fn move_selection(&mut self, delta: i32)
Move selection by delta, clamping to bounds
pub fn move_to_top(&mut self)
pub fn move_to_bottom(&mut self)
pub fn update_scroll_offset_for_selection(&mut self, viewport_rows: usize)
Trait Implementations§
Source§impl Clone for SearchableList
impl Clone for SearchableList
Source§fn clone(&self) -> SearchableList
fn clone(&self) -> SearchableList
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SearchableList
impl RefUnwindSafe for SearchableList
impl Send for SearchableList
impl Sync for SearchableList
impl Unpin for SearchableList
impl UnsafeUnpin for SearchableList
impl UnwindSafe for SearchableList
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