pub struct ScrollViewState { /* private fields */ }Implementations§
Source§impl ScrollViewState
impl ScrollViewState
pub fn new() -> Self
pub fn with_offset(offset: Position) -> Self
pub const fn set_offset(&mut self, offset: Position)
pub const fn offset(&self) -> Position
pub const fn scroll_up(&mut self)
pub const fn scroll_down(&mut self)
pub fn scroll_page_down(&mut self)
pub fn scroll_page_up(&mut self)
pub const fn scroll_left(&mut self)
pub const fn scroll_right(&mut self)
pub const fn scroll_to_top(&mut self)
pub fn scroll_to_bottom(&mut self)
Sourcepub const fn size(&self) -> Option<Size>
pub const fn size(&self) -> Option<Size>
The content size (the full scrollable buffer). None before the first render.
Sourcepub const fn page_size(&self) -> Option<Size>
pub const fn page_size(&self) -> Option<Size>
The visible page size (viewport after scrollbars). None before the first render.
Sourcepub fn is_at_bottom(&self) -> bool
pub fn is_at_bottom(&self) -> bool
Whether the last content row is visible in the current page.
Returns true before the first render (size unknown). Ported from upstream
tui-scrollview; relies on page_size meaning the visible viewport.
Sourcepub fn scroll_to_visible(&mut self, y: u16, height: u16)
pub fn scroll_to_visible(&mut self, y: u16, height: u16)
Scroll the vertical offset the minimum amount so the row range
[y, y + height) is inside the visible page. No-op if already visible.
The render pass re-clamps against the content, so this only needs to move the offset toward the target.
Sourcepub fn handle_event(&mut self, event: &Event) -> bool
pub fn handle_event(&mut self, event: &Event) -> bool
Returns true if the event was a scroll input this state acted on.
Trait Implementations§
Source§impl Clone for ScrollViewState
impl Clone for ScrollViewState
Source§fn clone(&self) -> ScrollViewState
fn clone(&self) -> ScrollViewState
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 moreimpl Copy for ScrollViewState
Source§impl Debug for ScrollViewState
impl Debug for ScrollViewState
Source§impl Default for ScrollViewState
impl Default for ScrollViewState
Source§fn default() -> ScrollViewState
fn default() -> ScrollViewState
Returns the “default value” for a type. Read more
impl Eq for ScrollViewState
Source§impl Hash for ScrollViewState
impl Hash for ScrollViewState
Source§impl PartialEq for ScrollViewState
impl PartialEq for ScrollViewState
Source§fn eq(&self, other: &ScrollViewState) -> bool
fn eq(&self, other: &ScrollViewState) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ScrollViewState
Auto Trait Implementations§
impl Freeze for ScrollViewState
impl RefUnwindSafe for ScrollViewState
impl Send for ScrollViewState
impl Sync for ScrollViewState
impl Unpin for ScrollViewState
impl UnsafeUnpin for ScrollViewState
impl UnwindSafe for ScrollViewState
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> 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