pub struct SyncTimelineEvent {
pub kind: TimelineEventKind,
pub push_actions: Vec<Action>,
}
Expand description
Represents a matrix room event that has been returned from /sync
,
after initial processing.
Previously, this differed from TimelineEvent
by wrapping an
AnySyncTimelineEvent
instead of an AnyTimelineEvent
, but nowadays
they are essentially identical, and one of them should probably be removed.
Fields§
§kind: TimelineEventKind
The event itself, together with any information on decryption.
push_actions: Vec<Action>
The push actions associated with this event.
Implementations§
§impl SyncTimelineEvent
impl SyncTimelineEvent
pub fn new(event: Raw<AnySyncTimelineEvent>) -> SyncTimelineEvent
pub fn new(event: Raw<AnySyncTimelineEvent>) -> SyncTimelineEvent
Create a new SyncTimelineEvent
from the given raw event.
This is a convenience constructor for a plaintext event when you don’t
need to set push_action
, for example inside a test.
pub fn new_with_push_actions(
event: Raw<AnySyncTimelineEvent>,
push_actions: Vec<Action>,
) -> SyncTimelineEvent
pub fn new_with_push_actions( event: Raw<AnySyncTimelineEvent>, push_actions: Vec<Action>, ) -> SyncTimelineEvent
Create a new SyncTimelineEvent
from the given raw event and push
actions.
This is a convenience constructor for a plaintext event, for example inside a test.
pub fn new_utd_event(
event: Raw<AnySyncTimelineEvent>,
utd_info: UnableToDecryptInfo,
) -> SyncTimelineEvent
pub fn new_utd_event( event: Raw<AnySyncTimelineEvent>, utd_info: UnableToDecryptInfo, ) -> SyncTimelineEvent
Create a new SyncTimelineEvent
to represent the given decryption
failure.
pub fn event_id(&self) -> Option<OwnedEventId>
pub fn event_id(&self) -> Option<OwnedEventId>
Get the event id of this SyncTimelineEvent
if the event has any valid
id.
pub fn raw(&self) -> &Raw<AnySyncTimelineEvent>
pub fn raw(&self) -> &Raw<AnySyncTimelineEvent>
Returns a reference to the (potentially decrypted) Matrix event inside
this TimelineEvent
.
pub fn encryption_info(&self) -> Option<&EncryptionInfo>
pub fn encryption_info(&self) -> Option<&EncryptionInfo>
If the event was a decrypted event that was successfully decrypted, get
its encryption info. Otherwise, None
.
pub fn into_raw(self) -> Raw<AnySyncTimelineEvent>
pub fn into_raw(self) -> Raw<AnySyncTimelineEvent>
Takes ownership of this TimelineEvent
, returning the (potentially
decrypted) Matrix event within.
Trait Implementations§
§impl Clone for SyncTimelineEvent
impl Clone for SyncTimelineEvent
§fn clone(&self) -> SyncTimelineEvent
fn clone(&self) -> SyncTimelineEvent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for SyncTimelineEvent
impl Debug for SyncTimelineEvent
§impl<'de> Deserialize<'de> for SyncTimelineEvent
impl<'de> Deserialize<'de> for SyncTimelineEvent
§fn deserialize<D>(
deserializer: D,
) -> Result<SyncTimelineEvent, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SyncTimelineEvent, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Custom deserializer for SyncTimelineEvent
, to support older formats.
Ideally we might use an untagged enum and then convert from that; however, that doesn’t work due to a serde bug.
Instead, we first deserialize into an unstructured JSON map, and then inspect the json to figure out which format we have.
§impl From<DecryptedRoomEvent> for SyncTimelineEvent
impl From<DecryptedRoomEvent> for SyncTimelineEvent
§fn from(decrypted: DecryptedRoomEvent) -> SyncTimelineEvent
fn from(decrypted: DecryptedRoomEvent) -> SyncTimelineEvent
§impl From<SyncTimelineEventDeserializationHelperV0> for SyncTimelineEvent
impl From<SyncTimelineEventDeserializationHelperV0> for SyncTimelineEvent
§fn from(value: SyncTimelineEventDeserializationHelperV0) -> SyncTimelineEvent
fn from(value: SyncTimelineEventDeserializationHelperV0) -> SyncTimelineEvent
§impl From<SyncTimelineEventDeserializationHelperV1> for SyncTimelineEvent
impl From<SyncTimelineEventDeserializationHelperV1> for SyncTimelineEvent
§fn from(value: SyncTimelineEventDeserializationHelperV1) -> SyncTimelineEvent
fn from(value: SyncTimelineEventDeserializationHelperV1) -> SyncTimelineEvent
§impl From<TimelineEvent> for SyncTimelineEvent
impl From<TimelineEvent> for SyncTimelineEvent
§fn from(o: TimelineEvent) -> SyncTimelineEvent
fn from(o: TimelineEvent) -> SyncTimelineEvent
§impl Serialize for SyncTimelineEvent
impl Serialize for SyncTimelineEvent
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for SyncTimelineEvent
impl RefUnwindSafe for SyncTimelineEvent
impl Send for SyncTimelineEvent
impl Sync for SyncTimelineEvent
impl Unpin for SyncTimelineEvent
impl UnwindSafe for SyncTimelineEvent
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
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