pub struct MessageScrollerState { /* private fields */ }Expand description
The entity-owned scrolling state for a MessageScroller.
The state owns only GPUI’s virtual-list bookkeeping. Message data remains
with the caller and is read by the row renderer passed to
MessageScroller::new.
Implementations§
Source§impl MessageScrollerState
impl MessageScrollerState
Sourcepub fn new(item_count: usize, cx: &mut Context<'_, Self>) -> Self
pub fn new(item_count: usize, cx: &mut Context<'_, Self>) -> Self
Create a state for item_count rows and enable tail following.
The constructor receives the entity context so the list’s scroll handler can safely defer its entity update until GPUI has released the list’s internal borrow.
Sourcepub fn item_count(&self) -> usize
pub fn item_count(&self) -> usize
Return the current number of rows known by the virtual list.
Sourcepub fn is_scrolled_up(&self) -> bool
pub fn is_scrolled_up(&self) -> bool
Return whether the user has scrolled away from the latest content.
Sourcepub fn is_following_tail(&self) -> bool
pub fn is_following_tail(&self) -> bool
Return whether the list is actively following its tail.
Sourcepub fn reset(&mut self, item_count: usize, cx: &mut Context<'_, Self>)
pub fn reset(&mut self, item_count: usize, cx: &mut Context<'_, Self>)
Reset the list to item_count rows.
Sourcepub fn splice(
&mut self,
old_range: Range<usize>,
count: usize,
cx: &mut Context<'_, Self>,
) -> bool
pub fn splice( &mut self, old_range: Range<usize>, count: usize, cx: &mut Context<'_, Self>, ) -> bool
Replace old_range with count new rows.
Returns false when the range is outside the current list and leaves
the state unchanged.
Sourcepub fn append(&mut self, count: usize, cx: &mut Context<'_, Self>) -> bool
pub fn append(&mut self, count: usize, cx: &mut Context<'_, Self>) -> bool
Append count rows to the end of the list.
Sourcepub fn prepend(&mut self, count: usize, cx: &mut Context<'_, Self>) -> bool
pub fn prepend(&mut self, count: usize, cx: &mut Context<'_, Self>) -> bool
Prepend count rows while preserving the current scroll anchor.
Sourcepub fn remeasure(&mut self, cx: &mut Context<'_, Self>)
pub fn remeasure(&mut self, cx: &mut Context<'_, Self>)
Mark all rows for remeasurement while preserving a proportional anchor.
Sourcepub fn remeasure_items(
&mut self,
range: Range<usize>,
cx: &mut Context<'_, Self>,
) -> bool
pub fn remeasure_items( &mut self, range: Range<usize>, cx: &mut Context<'_, Self>, ) -> bool
Mark rows in range for remeasurement while preserving an item anchor.
Returns false when the range is outside the current list.
Sourcepub fn scroll_to_item(
&mut self,
index: usize,
cx: &mut Context<'_, Self>,
) -> bool
pub fn scroll_to_item( &mut self, index: usize, cx: &mut Context<'_, Self>, ) -> bool
Scroll to the row at index, if it exists.
Sourcepub fn scroll_to_end(&mut self, cx: &mut Context<'_, Self>)
pub fn scroll_to_end(&mut self, cx: &mut Context<'_, Self>)
Resume tail following and scroll to the latest row.
Auto Trait Implementations§
impl !RefUnwindSafe for MessageScrollerState
impl !Send for MessageScrollerState
impl !Sync for MessageScrollerState
impl !UnwindSafe for MessageScrollerState
impl Freeze for MessageScrollerState
impl Unpin for MessageScrollerState
impl UnsafeUnpin for MessageScrollerState
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
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> ⓘ
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> ⓘ
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