pub struct EventFocusedCache { /* private fields */ }Expand description
A cache for an event-focused timeline.
This represents a timeline centred around a specific event (e.g., from a
permalink), supporting both forward and backward pagination. The focused
event may be part of a thread, in which case pagination will use the
/relations API instead of /messages.
Pagination tokens are stored as Gap items in the linked chunk itself:
- A gap at the front (first position) contains the backward pagination token.
- A gap at the back (last position) contains the forward pagination token.
This is a shallow data structure, and can be cloned cheaply.
Implementations§
Source§impl EventFocusedCache
impl EventFocusedCache
Sourcepub async fn events(&self) -> Result<Vec<Event>>
pub async fn events(&self) -> Result<Vec<Event>>
Read all current events.
Use EventFocusedCache::subscribe to get all current events, plus a
subscriber.
Sourcepub async fn subscribe(
&self,
) -> Result<(Vec<Event>, Receiver<TimelineVectorDiffs>)>
pub async fn subscribe( &self, ) -> Result<(Vec<Event>, Receiver<TimelineVectorDiffs>)>
Subscribe to updates from this event-focused timeline.
Sourcepub async fn hit_timeline_start(&self) -> Result<bool>
pub async fn hit_timeline_start(&self) -> Result<bool>
Check if we’ve hit the start of the timeline (no more backward pagination possible).
Sourcepub async fn hit_timeline_end(&self) -> Result<bool>
pub async fn hit_timeline_end(&self) -> Result<bool>
Check if we’ve hit the end of the timeline (no more forward pagination possible).
Sourcepub async fn paginate_backwards(
&self,
num_events: u16,
) -> Result<PaginationResult>
pub async fn paginate_backwards( &self, num_events: u16, ) -> Result<PaginationResult>
Paginate backwards in this event-focused timeline, be it room or thread pagination depending on the mode.
Sourcepub async fn paginate_forwards(
&self,
num_events: u16,
) -> Result<PaginationResult>
pub async fn paginate_forwards( &self, num_events: u16, ) -> Result<PaginationResult>
Paginate forwards in this event-focused timeline, be it room or thread pagination depending on the mode.
Sourcepub async fn thread_root(&self) -> Result<Option<OwnedEventId>>
pub async fn thread_root(&self) -> Result<Option<OwnedEventId>>
Get the thread root event ID if this linked chunk is in thread mode.
Trait Implementations§
Source§impl Clone for EventFocusedCache
impl Clone for EventFocusedCache
Source§fn clone(&self) -> EventFocusedCache
fn clone(&self) -> EventFocusedCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for EventFocusedCache
impl !UnwindSafe for EventFocusedCache
impl Freeze for EventFocusedCache
impl Send for EventFocusedCache
impl Sync for EventFocusedCache
impl Unpin for EventFocusedCache
impl UnsafeUnpin for EventFocusedCache
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
impl<T> AsyncTraitDeps for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
impl<T> CloneAnySend for T
impl<T> CloneAnySendSync for T
impl<T> CloneAnySync for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
impl<T> ErasedDestructor for Twhere
T: 'static,
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