pub struct MessageScrollerState { /* private fields */ }Expand description
Retained scrolling state for one conversation in one viewport.
Content and stable message identities belong to the application. Reuse this state across appends, streamed edits, and prepended history; create a new state when switching conversations. The first frame starts at the latest message.
Implementations§
Source§impl MessageScrollerState
impl MessageScrollerState
pub fn new(_: &mut Context<'_, Self>) -> Self
pub fn scroll_handle(&self) -> &ScrollHandle
Sourcepub fn is_following(&self) -> bool
pub fn is_following(&self) -> bool
Whether the last laid-out viewport was at its bottom edge.
Sourcepub fn unread_count(&self) -> usize
pub fn unread_count(&self) -> usize
Appended messages received while the reader was away from the bottom. Edits to an existing message and prepended history do not increase this.
Sourcepub fn jump_to_latest(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn jump_to_latest( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, )
Returns to the latest content and resumes following subsequent growth. The application’s jump control retains focus; messages do not receive it.
Auto Trait Implementations§
impl !RefUnwindSafe for MessageScrollerState
impl !Send for MessageScrollerState
impl !Sync for MessageScrollerState
impl !UnwindSafe for MessageScrollerState
impl Forget for MessageScrollerState
impl Freeze for MessageScrollerState
impl Move for MessageScrollerState
impl Unpin for MessageScrollerState
impl UnsafeUnpin for MessageScrollerStatewhere
*const RcInner<RefCell<ScrollHandleState>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<ScrollHandleState>>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ElementId>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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