pub struct ScrollState {
pub offset: usize,
pub page_size: usize,
}Expand description
Scroll offset tracker for content rendered via ScrollView.
Tracks offset (current scroll position) and a cached page_size
(visible rows). All navigation methods clamp automatically.
Fields§
§offset: usizeCurrent scroll offset (first visible row)
page_size: usizeCached page size (visible rows in the viewport)
Implementations§
Source§impl ScrollState
impl ScrollState
Sourcepub fn scroll_down(&mut self, content_len: usize)
pub fn scroll_down(&mut self, content_len: usize)
Scroll down by one row, clamped to content_len.
Sourcepub fn page_down(&mut self, content_len: usize)
pub fn page_down(&mut self, content_len: usize)
Scroll down by one page, clamped to content_len.
Sourcepub fn handle_scroll_key(&mut self, key: KeyCode, content_len: usize) -> bool
pub fn handle_scroll_key(&mut self, key: KeyCode, content_len: usize) -> bool
Handle standard scroll keys (j/k, arrows, g/G, Home/End, PageUp/PageDown).
Returns true if the key was consumed.
Trait Implementations§
Source§impl Clone for ScrollState
impl Clone for ScrollState
Source§fn clone(&self) -> ScrollState
fn clone(&self) -> ScrollState
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 moreSource§impl Debug for ScrollState
impl Debug for ScrollState
Auto Trait Implementations§
impl Freeze for ScrollState
impl RefUnwindSafe for ScrollState
impl Send for ScrollState
impl Sync for ScrollState
impl Unpin for ScrollState
impl UnsafeUnpin for ScrollState
impl UnwindSafe for ScrollState
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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