pub struct LibraryState {
pub tab: LibraryTab,
pub selected: usize,
}Expand description
The page’s own state: which tab, and which row the cursor is on.
One cursor for both tabs, clamped to the active tab’s row count when the tab changes — so switching tabs never leaves the cursor past the end of a shorter list.
Fields§
§tab: LibraryTabThe active tab.
selected: usizeThe selected row inside the active tab, 0-based.
Implementations§
Source§impl LibraryState
impl LibraryState
Sourcepub fn move_selected(&mut self, delta: isize, rows: usize) -> bool
pub fn move_selected(&mut self, delta: isize, rows: usize) -> bool
Move the cursor by delta rows, clamped to rows entries (which may be
zero). Returns true when the cursor moved.
Sourcepub fn clamp_selected(&mut self, rows: usize)
pub fn clamp_selected(&mut self, rows: usize)
Clamp the cursor into rows entries, for use after the registry changed
underneath the page (a view deleted from another surface, say).
Trait Implementations§
Source§impl Clone for LibraryState
impl Clone for LibraryState
Source§impl Debug for LibraryState
impl Debug for LibraryState
Source§impl Default for LibraryState
impl Default for LibraryState
impl Eq for LibraryState
Source§impl PartialEq for LibraryState
impl PartialEq for LibraryState
impl StructuralPartialEq for LibraryState
Auto Trait Implementations§
impl Freeze for LibraryState
impl RefUnwindSafe for LibraryState
impl Send for LibraryState
impl Sync for LibraryState
impl Unpin for LibraryState
impl UnsafeUnpin for LibraryState
impl UnwindSafe for LibraryState
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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