Struct matrix_sdk::event_cache::paginator::Paginator
source · pub struct Paginator<PR: PaginableRoom> { /* private fields */ }
Expand description
A stateful object to reach to an event, and then paginate backward and forward from it.
See also the module-level documentation.
Implementations§
source§impl<PR: PaginableRoom> Paginator<PR>
impl<PR: PaginableRoom> Paginator<PR>
sourcepub fn state(&self) -> Subscriber<PaginatorState>
pub fn state(&self) -> Subscriber<PaginatorState>
Returns a subscriber to the internal PaginatorState
machine.
sourcepub async fn start_from(
&self,
event_id: &EventId,
num_events: UInt,
) -> Result<StartFromResult, PaginatorError>
pub async fn start_from( &self, event_id: &EventId, num_events: UInt, ) -> Result<StartFromResult, PaginatorError>
Starts the pagination from the initial event, requesting num_events
additional context events.
Only works for fresh Paginator
objects, which are in the
PaginatorState::Initial
state.
sourcepub async fn paginate_backward(
&self,
num_events: UInt,
) -> Result<PaginationResult, PaginatorError>
pub async fn paginate_backward( &self, num_events: UInt, ) -> Result<PaginationResult, PaginatorError>
Runs a backward pagination (requesting num_events
to the server), from
the current state of the object.
Will return immediately if we have already hit the start of the timeline.
May return an error if it’s already paginating, or if the call to /messages failed.
sourcepub fn hit_timeline_start(&self) -> bool
pub fn hit_timeline_start(&self) -> bool
Returns whether we’ve hit the start of the timeline.
This is true if, and only if, we didn’t have a previous-batch token and running backwards pagination would be useless.
sourcepub fn hit_timeline_end(&self) -> bool
pub fn hit_timeline_end(&self) -> bool
Returns whether we’ve hit the end of the timeline.
This is true if, and only if, we didn’t have a next-batch token and running forwards pagination would be useless.
sourcepub async fn paginate_forward(
&self,
num_events: UInt,
) -> Result<PaginationResult, PaginatorError>
pub async fn paginate_forward( &self, num_events: UInt, ) -> Result<PaginationResult, PaginatorError>
Runs a forward pagination (requesting num_events
to the server), from
the current state of the object.
Will return immediately if we have already hit the end of the timeline.
May return an error if it’s already paginating, or if the call to /messages failed.
Trait Implementations§
Auto Trait Implementations§
impl<PR> !Freeze for Paginator<PR>
impl<PR> RefUnwindSafe for Paginator<PR>where
PR: RefUnwindSafe,
impl<PR> Send for Paginator<PR>
impl<PR> Sync for Paginator<PR>
impl<PR> Unpin for Paginator<PR>where
PR: Unpin,
impl<PR> UnwindSafe for Paginator<PR>where
PR: UnwindSafe,
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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