pub struct Selection {
pub index: usize,
pub len: usize,
/* private fields */
}Expand description
Wrap-around index navigation with viewport scrolling
Uses Cell for offset/visible to allow updates from immutable context (e.g., render).
Fields§
§index: usizeCurrently selected index
len: usizeTotal number of items
Implementations§
Source§impl Selection
impl Selection
Sourcepub fn set_visible(&self, visible: usize)
pub fn set_visible(&self, visible: usize)
Set visible count (can be called from &self context due to Cell)
Sourcepub fn visible_range(&self) -> Range<usize>
pub fn visible_range(&self) -> Range<usize>
Get visible range (start..end indices)
Sourcepub fn reset_offset(&mut self)
pub fn reset_offset(&mut self)
Reset offset to 0 (scroll to top)
Sourcepub fn is_selected(&self, index: usize) -> bool
pub fn is_selected(&self, index: usize) -> bool
Check if index is currently selected
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Selection
impl !RefUnwindSafe for Selection
impl Send for Selection
impl !Sync for Selection
impl Unpin for Selection
impl UnsafeUnpin for Selection
impl UnwindSafe for Selection
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