pub struct RawSyncStateEventWithKeys {
pub raw: Raw<AnySyncStateEvent>,
pub event_type: StateEventType,
pub state_key: String,
/* private fields */
}Expand description
A raw sync state event and its (type, state_key) tuple that identifies it
in the state map of the room.
This type can also cache the deserialized event lazily when using
RawSyncStateEventWithKeys::deserialize_as().
Fields§
§raw: Raw<AnySyncStateEvent>The raw state event.
event_type: StateEventTypeThe type of the state event.
state_key: StringThe state key of the state event.
Implementations§
Source§impl RawSyncStateEventWithKeys
impl RawSyncStateEventWithKeys
Sourcepub fn try_from_raw_state_event(raw: Raw<AnySyncStateEvent>) -> Option<Self>
pub fn try_from_raw_state_event(raw: Raw<AnySyncStateEvent>) -> Option<Self>
Try to construct a RawSyncStateEventWithKeys from the given raw state
event.
Returns None if extracting the type or state_key fails.
Sourcepub fn try_from_raw_timeline_event(
raw: &Raw<AnySyncTimelineEvent>,
) -> Option<Self>
pub fn try_from_raw_timeline_event( raw: &Raw<AnySyncTimelineEvent>, ) -> Option<Self>
Try to construct a RawSyncStateEventWithKeys from the given raw
timeline event.
Returns None if deserializing the type or state_key fails, or if
the event is not a state event.
Sourcepub fn deserialize_as<F, C>(
&mut self,
as_variant_fn: F,
) -> Option<&SyncStateEvent<C>>where
F: FnOnce(&AnySyncStateEvent) -> Option<&SyncStateEvent<C>>,
C: StaticEventContent + StaticStateEventContent + RedactContent,
C::Redacted: RedactedStateEventContent,
pub fn deserialize_as<F, C>(
&mut self,
as_variant_fn: F,
) -> Option<&SyncStateEvent<C>>where
F: FnOnce(&AnySyncStateEvent) -> Option<&SyncStateEvent<C>>,
C: StaticEventContent + StaticStateEventContent + RedactContent,
C::Redacted: RedactedStateEventContent,
Try to deserialize the raw event and return the selected variant of
AnySyncStateEvent.
This method should only be called if the variant is already known. It is
considered a developer error for as_variant_fn to return None, but
this API was chosen to simplify closures that use the
as_variant! macro.
The result of the event deserialization is cached for future calls to this method.
Returns None if the deserialization failed or if as_variant_fn
returns None.
Trait Implementations§
Source§impl Clone for RawSyncStateEventWithKeys
impl Clone for RawSyncStateEventWithKeys
Source§fn clone(&self) -> RawSyncStateEventWithKeys
fn clone(&self) -> RawSyncStateEventWithKeys
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 RawSyncStateEventWithKeys
impl RefUnwindSafe for RawSyncStateEventWithKeys
impl Send for RawSyncStateEventWithKeys
impl Sync for RawSyncStateEventWithKeys
impl Unpin for RawSyncStateEventWithKeys
impl UnwindSafe for RawSyncStateEventWithKeys
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, 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