Struct matrix_sdk::event_cache::paginator::Paginator
source · pub struct Paginator { /* 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 Paginator
impl Paginator
sourcepub fn new(room: Box<dyn PaginableRoom>) -> Self
pub fn new(room: Box<dyn PaginableRoom>) -> Self
Create a new Paginator
, given a room implementation.
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 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 !RefUnwindSafe for Paginator
impl Send for Paginator
impl Sync for Paginator
impl Unpin for Paginator
impl !UnwindSafe for Paginator
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§fn clone_handle(handle: Handle) -> Handle
fn clone_handle(handle: Handle) -> Handle
§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>