pub struct EventCache { /* private fields */ }Expand description
An event cache, providing lots of useful functionality for clients.
Cloning is shallow, and thus is cheap to do.
See also the module-level comment.
Implementations§
Source§impl EventCache
impl EventCache
Sourcepub fn enable_storage(&self) -> Result<()>
pub fn enable_storage(&self) -> Result<()>
Enable storing updates to storage, and reload events from storage.
Has an effect only the first time it’s called. It’s safe to call it multiple times.
Sourcepub fn has_storage(&self) -> bool
pub fn has_storage(&self) -> bool
Check whether the storage is enabled or not.
Sourcepub fn subscribe(&self) -> Result<()>
pub fn subscribe(&self) -> Result<()>
Starts subscribing the EventCache to sync responses, if not done
before.
Re-running this has no effect if we already subscribed before, and is cheap.
Sourcepub async fn clear_all_rooms(&self) -> Result<()>
pub async fn clear_all_rooms(&self) -> Result<()>
Cleanly clear all the rooms’ event caches.
This will notify any live observers that the room has been cleared.
Sourcepub async fn add_initial_events(
&self,
room_id: &RoomId,
events: Vec<TimelineEvent>,
prev_batch: Option<String>,
) -> Result<()>
pub async fn add_initial_events( &self, room_id: &RoomId, events: Vec<TimelineEvent>, prev_batch: Option<String>, ) -> Result<()>
Add an initial set of events to the event cache, reloaded from a cache.
TODO: temporary for API compat, as the event cache should take care of its own store.
Trait Implementations§
Source§impl Clone for EventCache
impl Clone for EventCache
Source§fn clone(&self) -> EventCache
fn clone(&self) -> EventCache
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 EventCache
impl !RefUnwindSafe for EventCache
impl Send for EventCache
impl Sync for EventCache
impl Unpin for EventCache
impl !UnwindSafe for EventCache
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,
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