Skip to main content

Event

Trait Event 

Source
pub trait Event:
    Clone
    + Debug
    + Send
    + Sync {
Show 33 methods // Required methods fn as_pdu(&self) -> &Pdu; fn into_pdu(self) -> Pdu; fn is_owned(&self) -> bool; fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_; fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send; fn content(&self) -> &RawJsonValue; fn event_id(&self) -> &EventId; fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch; fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_; fn redacts(&self) -> Option<&EventId>; fn rejected(&self) -> bool; fn room_id(&self) -> &RoomId; fn sender(&self) -> &UserId; fn state_key(&self) -> Option<&str>; fn kind(&self) -> &TimelineEventType; fn unsigned(&self) -> Option<&RawJsonValue>; // Provided methods fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool { ... } fn into_format<T>(self) -> T where T: From<Owned<Self>>, Self: Sized { ... } fn to_format<'a, T>(&'a self) -> T where T: From<Ref<'a, Self>>, Self: Sized + 'a { ... } fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool where T: FnOnce(&JsonValue) -> bool, Self: Sized { ... } fn get_unsigned_property<T>(&self, property: &str) -> Result<T> where T: for<'de> Deserialize<'de>, Self: Sized { ... } fn get_unsigned_as_value(&self) -> JsonValue where Self: Sized { ... } fn get_unsigned<T>(&self) -> Result<T> where T: for<'de> Deserialize<'de>, Self: Sized { ... } fn get_content_as_value(&self) -> JsonValue where Self: Sized { ... } fn get_content<T>(&self) -> Result<T> where for<'de> T: Deserialize<'de>, Self: Sized { ... } fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId> where Self: Sized { ... } fn is_redacted(&self) -> bool where Self: Sized { ... } fn into_canonical_object(self) -> CanonicalJsonObject where Self: Sized { ... } fn to_canonical_object(&self) -> CanonicalJsonObject { ... } fn into_value(self) -> JsonValue where Self: Sized { ... } fn to_value(&self) -> JsonValue { ... } fn as_mut_pdu(&mut self) -> &mut Pdu { ... } fn event_type(&self) -> &TimelineEventType { ... }
}
Expand description

Abstraction of a PDU so users can have their own PDU types.

Required Methods§

Source

fn as_pdu(&self) -> &Pdu

Source

fn into_pdu(self) -> Pdu

Source

fn is_owned(&self) -> bool

Source

fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_

All the authenticating events for this event.

Source

fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send

All the authenticating events for this event.

Source

fn content(&self) -> &RawJsonValue

The event’s content.

Source

fn event_id(&self) -> &EventId

The EventId of this event.

Source

fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch

The time of creation on the originating server.

Source

fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_

The events before this event.

Source

fn redacts(&self) -> Option<&EventId>

If this event is a redaction event this is the event it redacts.

Source

fn rejected(&self) -> bool

Source

fn room_id(&self) -> &RoomId

The RoomId of this event.

Source

fn sender(&self) -> &UserId

The UserId of this event.

Source

fn state_key(&self) -> Option<&str>

The state key for this event.

Source

fn kind(&self) -> &TimelineEventType

The event type.

Source

fn unsigned(&self) -> Option<&RawJsonValue>

Metadata container; peer-trusted only.

Provided Methods§

Source

fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool

Source

fn into_format<T>(self) -> T
where T: From<Owned<Self>>, Self: Sized,

Serialize into a Ruma JSON format, consuming.

Source

fn to_format<'a, T>(&'a self) -> T
where T: From<Ref<'a, Self>>, Self: Sized + 'a,

Serialize into a Ruma JSON format

Source

fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
where T: FnOnce(&JsonValue) -> bool, Self: Sized,

Source

fn get_unsigned_property<T>(&self, property: &str) -> Result<T>
where T: for<'de> Deserialize<'de>, Self: Sized,

Source

fn get_unsigned_as_value(&self) -> JsonValue
where Self: Sized,

Source

fn get_unsigned<T>(&self) -> Result<T>
where T: for<'de> Deserialize<'de>, Self: Sized,

Source

fn get_content_as_value(&self) -> JsonValue
where Self: Sized,

Source

fn get_content<T>(&self) -> Result<T>
where for<'de> T: Deserialize<'de>, Self: Sized,

Source

fn redacts_id(&self, room_rules: &RoomVersionRules) -> Option<OwnedEventId>
where Self: Sized,

Source

fn is_redacted(&self) -> bool
where Self: Sized,

Source

fn into_canonical_object(self) -> CanonicalJsonObject
where Self: Sized,

Source

fn to_canonical_object(&self) -> CanonicalJsonObject

Source

fn into_value(self) -> JsonValue
where Self: Sized,

Source

fn to_value(&self) -> JsonValue

Source

fn as_mut_pdu(&mut self) -> &mut Pdu

Source

fn event_type(&self) -> &TimelineEventType

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Event for &Pdu
where Self: Send,

Source§

impl Event for Pdu
where Self: Send + Sync + 'static,