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§
fn as_pdu(&self) -> &Pdu
fn into_pdu(self) -> Pdu
fn is_owned(&self) -> bool
Sourcefn auth_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn auth_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
All the authenticating events for this event.
Sourcefn auth_events_into(
self,
) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
fn auth_events_into( self, ) -> impl IntoIterator<IntoIter = impl Iterator<Item = OwnedEventId>> + Send
All the authenticating events for this event.
Sourcefn content(&self) -> &RawJsonValue
fn content(&self) -> &RawJsonValue
The event’s content.
Sourcefn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch
The time of creation on the originating server.
Sourcefn prev_events(
&self,
) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
fn prev_events( &self, ) -> impl DoubleEndedIterator<Item = &EventId> + Clone + Send + '_
The events before this event.
Sourcefn redacts(&self) -> Option<&EventId>
fn redacts(&self) -> Option<&EventId>
If this event is a redaction event this is the event it redacts.
Sourcefn unsigned(&self) -> Option<&RawJsonValue>
fn unsigned(&self) -> Option<&RawJsonValue>
Metadata container; peer-trusted only.
Provided Methods§
fn is_type_and_state_key( &self, kind: &TimelineEventType, state_key: &str, ) -> bool
Sourcefn into_format<T>(self) -> T
fn into_format<T>(self) -> T
Serialize into a Ruma JSON format, consuming.
fn contains_unsigned_property<T>(&self, property: &str, is_type: T) -> bool
fn get_unsigned_property<T>(&self, property: &str) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_unsigned_as_value(&self) -> JsonValuewhere
Self: Sized,
fn get_unsigned<T>(&self) -> Result<T>where
T: for<'de> Deserialize<'de>,
Self: Sized,
fn get_content_as_value(&self) -> JsonValuewhere
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) -> boolwhere
Self: Sized,
fn into_canonical_object(self) -> CanonicalJsonObjectwhere
Self: Sized,
fn to_canonical_object(&self) -> CanonicalJsonObject
fn into_value(self) -> JsonValuewhere
Self: Sized,
fn to_value(&self) -> JsonValue
fn as_mut_pdu(&mut self) -> &mut Pdu
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.