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.
Sourcepub async fn replace_utds(
&self,
events: &[(OwnedEventId, DecryptedRoomEvent, Option<Vec<Action>>)],
) -> Result<()>
Available on crate feature e2e-encryption only.
pub async fn replace_utds( &self, events: &[(OwnedEventId, DecryptedRoomEvent, Option<Vec<Action>>)], ) -> Result<()>
e2e-encryption only.Try to locate the events in the linked chunk corresponding to the given list of decrypted events, and replace them, while alerting observers about the update.
Trait Implementations§
Source§impl Clone for EventFocusedCache
impl Clone for EventFocusedCache
Source§fn clone(&self) -> EventFocusedCache
fn clone(&self) -> EventFocusedCache
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EventFocusedCache
impl !RefUnwindSafe for EventFocusedCache
impl Send for EventFocusedCache
impl Sync for EventFocusedCache
impl Unpin for EventFocusedCache
impl UnsafeUnpin for EventFocusedCache
impl !UnwindSafe for EventFocusedCache
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for 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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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