pub struct TimelineEvent {
pub kind: TimelineEventKind,
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
pub thread_summary: ThreadSummaryStatus,
pub bundled_latest_thread_event: Option<Box<TimelineEvent>>,
/* private fields */
}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: TimelineEventKindThe event itself, together with any information on decryption.
timestamp: Option<MilliSecondsSinceUnixEpoch>The timestamp of the event. It’s the origin_server_ts value (if any),
corrected if detected as malicious.
It can be None if the event has been serialised before the addition of
this field, or if parsing the origin_server_ts value failed.
thread_summary: ThreadSummaryStatusIf the event is part of a thread, a thread summary.
bundled_latest_thread_event: Option<Box<TimelineEvent>>The bundled latest thread event, if it was provided in the unsigned relations of this event.
Not serialized.
Implementations§
Source§impl TimelineEvent
impl TimelineEvent
Sourcepub fn from_plaintext(event: Raw<AnySyncTimelineEvent>) -> TimelineEvent
pub fn from_plaintext(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.
Sourcepub fn from_plaintext_with_max_timestamp(
event: Raw<AnySyncTimelineEvent>,
max_timestamp: MilliSecondsSinceUnixEpoch,
) -> TimelineEvent
pub fn from_plaintext_with_max_timestamp( event: Raw<AnySyncTimelineEvent>, max_timestamp: MilliSecondsSinceUnixEpoch, ) -> TimelineEvent
Like TimelineEvent::from_plaintext but with a given max_timestamp.
Sourcepub fn from_decrypted(
decrypted: DecryptedRoomEvent,
push_actions: Option<Vec<Action>>,
) -> TimelineEvent
pub fn from_decrypted( decrypted: DecryptedRoomEvent, push_actions: Option<Vec<Action>>, ) -> TimelineEvent
Create a new TimelineEvent from a decrypted event.
Sourcepub fn from_decrypted_with_max_timestamp(
decrypted: DecryptedRoomEvent,
push_actions: Option<Vec<Action>>,
max_timestamp: MilliSecondsSinceUnixEpoch,
) -> TimelineEvent
pub fn from_decrypted_with_max_timestamp( decrypted: DecryptedRoomEvent, push_actions: Option<Vec<Action>>, max_timestamp: MilliSecondsSinceUnixEpoch, ) -> TimelineEvent
Like TimelineEvent::from_decrypted but with a given max_timestamp.
Sourcepub fn from_utd(
event: Raw<AnySyncTimelineEvent>,
utd_info: UnableToDecryptInfo,
) -> TimelineEvent
pub fn from_utd( event: Raw<AnySyncTimelineEvent>, utd_info: UnableToDecryptInfo, ) -> TimelineEvent
Create a new TimelineEvent to represent the given decryption
failure.
Sourcepub fn from_utd_with_max_timestamp(
event: Raw<AnySyncTimelineEvent>,
utd_info: UnableToDecryptInfo,
max_timestamp: MilliSecondsSinceUnixEpoch,
) -> TimelineEvent
pub fn from_utd_with_max_timestamp( event: Raw<AnySyncTimelineEvent>, utd_info: UnableToDecryptInfo, max_timestamp: MilliSecondsSinceUnixEpoch, ) -> TimelineEvent
Like TimelineEvent::from_utd but with a given max_timestamp.
Sourcepub fn to_decrypted(
&self,
decrypted: DecryptedRoomEvent,
push_actions: Option<Vec<Action>>,
) -> TimelineEvent
pub fn to_decrypted( &self, decrypted: DecryptedRoomEvent, push_actions: Option<Vec<Action>>, ) -> TimelineEvent
Transform this TimelineEvent into another TimelineEvent with the
TimelineEventKind::Decrypted kind.
§Panics
It panics (on debug builds only) if the kind already is
TimelineEventKind::Decrypted.
Sourcepub fn to_utd(&self, utd_info: UnableToDecryptInfo) -> TimelineEvent
pub fn to_utd(&self, utd_info: UnableToDecryptInfo) -> TimelineEvent
Transform this TimelineEvent into another TimelineEvent with the
TimelineEventKind::Decrypted kind.
§Panics
It panics (on debug builds only) if the kind already is
TimelineEventKind::Decrypted.
Sourcepub fn push_actions(&self) -> Option<&[Action]>
pub fn push_actions(&self) -> Option<&[Action]>
Read the current push actions.
Returns None if they were never computed, or if they could not be
computed.
Sourcepub fn set_push_actions(&mut self, push_actions: Vec<Action>)
pub fn set_push_actions(&mut self, push_actions: Vec<Action>)
Set the push actions for this event.
Sourcepub fn event_id(&self) -> Option<OwnedEventId>
pub fn event_id(&self) -> Option<OwnedEventId>
Get the event id of this TimelineEvent if the event has any valid
id.
Sourcepub fn raw(&self) -> &Raw<AnySyncTimelineEvent>
pub fn raw(&self) -> &Raw<AnySyncTimelineEvent>
Returns a reference to the (potentially decrypted) Matrix event inside
this TimelineEvent.
Sourcepub fn replace_raw(&mut self, replacement: Raw<AnyTimelineEvent>)
pub fn replace_raw(&mut self, replacement: Raw<AnyTimelineEvent>)
Replace the raw event included in this item by another one.
Sourcepub fn timestamp(&self) -> Option<MilliSecondsSinceUnixEpoch>
pub fn timestamp(&self) -> Option<MilliSecondsSinceUnixEpoch>
Get the timestamp.
If the timestamp is missing (most likely because the event has been
created before the addition of the TimelineEvent::timestamp field),
this method will try to extract it from the origin_server_ts value. If
the origin_server_ts value is malicious, it will be capped to
MilliSecondsSinceUnixEpoch::now. It means that the returned value
might not be constant.
Sourcepub fn timestamp_raw(&self) -> Option<MilliSecondsSinceUnixEpoch>
pub fn timestamp_raw(&self) -> Option<MilliSecondsSinceUnixEpoch>
Get the timestamp value, without trying to backfill it if None.
Sourcepub fn encryption_info(&self) -> Option<&Arc<EncryptionInfo>>
pub fn encryption_info(&self) -> Option<&Arc<EncryptionInfo>>
If the event was a decrypted event that was successfully decrypted, get
its encryption info. Otherwise, None.
Sourcepub 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§
Source§impl Clone for TimelineEvent
impl Clone for TimelineEvent
Source§fn clone(&self) -> TimelineEvent
fn clone(&self) -> TimelineEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TimelineEvent
impl Debug for TimelineEvent
Source§impl<'de> Deserialize<'de> for TimelineEvent
impl<'de> Deserialize<'de> for TimelineEvent
Source§fn deserialize<D>(
deserializer: D,
) -> Result<TimelineEvent, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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<Event> for TimelineEvent
impl From<Event> for TimelineEvent
Source§fn from(value: Event) -> TimelineEvent
fn from(value: Event) -> TimelineEvent
Source§impl<E> From<EventBuilder<E>> for TimelineEvent
impl<E> From<EventBuilder<E>> for TimelineEvent
Source§fn from(val: EventBuilder<E>) -> TimelineEvent
fn from(val: EventBuilder<E>) -> TimelineEvent
Source§impl From<SyncTimelineEventDeserializationHelperV0> for TimelineEvent
impl From<SyncTimelineEventDeserializationHelperV0> for TimelineEvent
Source§fn from(value: SyncTimelineEventDeserializationHelperV0) -> TimelineEvent
fn from(value: SyncTimelineEventDeserializationHelperV0) -> TimelineEvent
Source§impl From<SyncTimelineEventDeserializationHelperV1> for TimelineEvent
impl From<SyncTimelineEventDeserializationHelperV1> for TimelineEvent
Source§fn from(value: SyncTimelineEventDeserializationHelperV1) -> TimelineEvent
fn from(value: SyncTimelineEventDeserializationHelperV1) -> TimelineEvent
Source§impl IndexableItem for TimelineEvent
impl IndexableItem for TimelineEvent
type ItemId = OwnedEventId
Source§fn id(&self) -> <TimelineEvent as IndexableItem>::ItemId
fn id(&self) -> <TimelineEvent as IndexableItem>::ItemId
Source§impl Serialize for TimelineEvent
impl Serialize for TimelineEvent
Source§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,
impl Send for TimelineEvent
impl Sync for TimelineEvent
Auto Trait Implementations§
impl Freeze for TimelineEvent
impl RefUnwindSafe for TimelineEvent
impl Unpin for TimelineEvent
impl UnwindSafe for TimelineEvent
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
§impl<T> DeserialiseFromJs for Twhere
T: DeserializeOwned,
impl<T> DeserialiseFromJs for Twhere
T: DeserializeOwned,
§fn deserialise_from_js(js: JsValue) -> Result<T, Error>
fn deserialise_from_js(js: JsValue) -> Result<T, Error>
serde_wasm_bindgen.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, 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> SerialiseToJs for Twhere
T: Serialize,
impl<T> SerialiseToJs for Twhere
T: Serialize,
§fn serialise_to_js(&self) -> Result<JsValue, Error>
fn serialise_to_js(&self) -> Result<JsValue, Error>
JsValue, most likely using serde_wasm_bindgen.