Type Alias Event

Source
pub type Event = TimelineEvent;
Expand description

The kind of event the event storage holds.

Aliased Type§

struct Event {
    pub kind: TimelineEventKind,
    pub push_actions: Option<Vec<Action>>,
}

Fields§

§kind: TimelineEventKind

The event itself, together with any information on decryption.

§push_actions: Option<Vec<Action>>

The push actions associated with this event.

If it’s set to None, then it means we couldn’t compute those actions.

Implementations

Source§

impl TimelineEvent

Source

pub fn new(event: Raw<AnySyncTimelineEvent>) -> TimelineEvent

Create a new TimelineEvent 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.

Source

pub fn new_with_push_actions( event: Raw<AnySyncTimelineEvent>, push_actions: Vec<Action>, ) -> TimelineEvent

Create a new TimelineEvent from the given raw event and push actions.

This is a convenience constructor for a plaintext event, for example inside a test.

Source

pub fn new_utd_event( event: Raw<AnySyncTimelineEvent>, utd_info: UnableToDecryptInfo, ) -> TimelineEvent

Create a new TimelineEvent to represent the given decryption failure.

Source

pub fn event_id(&self) -> Option<OwnedEventId>

Get the event id of this TimelineEvent if the event has any valid id.

Source

pub fn raw(&self) -> &Raw<AnySyncTimelineEvent>

Returns a reference to the (potentially decrypted) Matrix event inside this TimelineEvent.

Source

pub fn replace_raw(&mut self, replacement: Raw<AnyMessageLikeEvent>)

Replace the raw event included in this item by another one.

Source

pub fn encryption_info(&self) -> Option<&EncryptionInfo>

If the event was a decrypted event that was successfully decrypted, get its encryption info. Otherwise, None.

Source

pub fn into_raw(self) -> Raw<AnySyncTimelineEvent>

Takes ownership of this TimelineEvent, returning the (potentially decrypted) Matrix event within.

Trait Implementations

Source§

impl Clone for TimelineEvent

Source§

fn clone(&self) -> TimelineEvent

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TimelineEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TimelineEvent

Source§

fn deserialize<D>( deserializer: D, ) -> Result<TimelineEvent, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Custom deserializer for TimelineEvent, 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.

Source§

impl From<DecryptedRoomEvent> for TimelineEvent

Source§

fn from(decrypted: DecryptedRoomEvent) -> TimelineEvent

Converts to this type from the input type.
Source§

impl From<SyncTimelineEventDeserializationHelperV0> for TimelineEvent

Source§

fn from(value: SyncTimelineEventDeserializationHelperV0) -> TimelineEvent

Converts to this type from the input type.
Source§

impl From<SyncTimelineEventDeserializationHelperV1> for TimelineEvent

Source§

fn from(value: SyncTimelineEventDeserializationHelperV1) -> TimelineEvent

Converts to this type from the input type.
Source§

impl Serialize for TimelineEvent

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Send for TimelineEvent

Available on non-crate feature test-send-sync only.
Source§

impl Sync for TimelineEvent

Available on non-crate feature test-send-sync only.