pub struct RoomEventCache { /* private fields */ }Expand description
A subset of an event cache, for a room.
Cloning is shallow, and thus is cheap to do.
Implementations§
Source§impl RoomEventCache
impl RoomEventCache
Sourcepub fn room_id(&self) -> &RoomId
pub fn room_id(&self) -> &RoomId
Get the room ID for this RoomEventCache.
Sourcepub async fn events(&self) -> Result<Vec<Event>>
pub async fn events(&self) -> Result<Vec<Event>>
Read all current events.
Use RoomEventCache::subscribe to get all current events, plus a
subscriber.
Sourcepub async fn subscribe(
&self,
) -> Result<(Vec<Event>, Subscriber<RoomEventCacheUpdate>)>
pub async fn subscribe( &self, ) -> Result<(Vec<Event>, Subscriber<RoomEventCacheUpdate>)>
Subscribe to this room updates, after getting the initial list of events.
Use RoomEventCache::events to get all current events without the
subscriber. Creating, and especially dropping, a Subscriber isn’t
free, as it triggers side-effects.
Sourcepub fn pagination(&self) -> RoomPagination
pub fn pagination(&self) -> RoomPagination
Return a RoomPagination type useful for running back-pagination
queries in the current room.
Sourcepub async fn rfind_map_event_in_memory_by<O, P>(
&self,
predicate: P,
) -> Result<Option<O>>
pub async fn rfind_map_event_in_memory_by<O, P>( &self, predicate: P, ) -> Result<Option<O>>
Try to find a single event in this room, starting from the most recent event.
The predicate receives the current event as its single argument.
Warning! It looks into the loaded events from the in-memory linked chunk only. It doesn’t look inside the storage.
Sourcepub async fn find_event(&self, event_id: &EventId) -> Result<Option<Event>>
pub async fn find_event(&self, event_id: &EventId) -> Result<Option<Event>>
Try to find an event by ID in this room.
It starts by looking into loaded events before looking inside the storage.
Sourcepub async fn find_event_with_relations(
&self,
event_id: &EventId,
filter: Option<Vec<RelationType>>,
) -> Result<Option<(Event, Vec<Event>)>>
pub async fn find_event_with_relations( &self, event_id: &EventId, filter: Option<Vec<RelationType>>, ) -> Result<Option<(Event, Vec<Event>)>>
Try to find an event by ID in this room, along with its related events.
You can filter which types of related events to retrieve using
filter. None will retrieve related events of any type.
The related events are sorted like this:
- events saved out-of-band (with
RoomEventCache::save_events) will be located at the beginning of the array. - events present in the linked chunk (be it in memory or in the storage) will be sorted according to their ordering in the linked chunk.
Sourcepub async fn find_event_relations(
&self,
event_id: &EventId,
filter: Option<Vec<RelationType>>,
) -> Result<Vec<Event>>
pub async fn find_event_relations( &self, event_id: &EventId, filter: Option<Vec<RelationType>>, ) -> Result<Vec<Event>>
Try to find the related events for an event by ID in this room.
You can filter which types of related events to retrieve using
filter. None will retrieve related events of any type.
The related events are sorted like this:
- events saved out-of-band (with
RoomEventCache::save_events) will be located at the beginning of the array. - events present in the linked chunk (be it in memory or in the storage) will be sorted according to their ordering in the linked chunk.
Sourcepub async fn debug_string(&self) -> Vec<String>
pub async fn debug_string(&self) -> Vec<String>
Return a nice debug string (a vector of lines) for the linked chunk of events for this room.
Trait Implementations§
Source§impl Clone for RoomEventCache
impl Clone for RoomEventCache
Source§fn clone(&self) -> RoomEventCache
fn clone(&self) -> RoomEventCache
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 RoomEventCache
impl !RefUnwindSafe for RoomEventCache
impl Send for RoomEventCache
impl Sync for RoomEventCache
impl Unpin for RoomEventCache
impl UnsafeUnpin for RoomEventCache
impl !UnwindSafe for RoomEventCache
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
§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
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read moreSource§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