ruma::state_res

Trait Event

Source
pub trait Event {
    type Id: Clone + Debug + Display + Eq + Ord + Hash + Borrow<EventId>;

    // Required methods
    fn event_id(&self) -> &Self::Id;
    fn room_id(&self) -> &RoomId;
    fn sender(&self) -> &UserId;
    fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch;
    fn event_type(&self) -> &TimelineEventType;
    fn content(&self) -> &RawValue;
    fn state_key(&self) -> Option<&str>;
    fn prev_events(&self) -> Box<dyn DoubleEndedIterator<Item = &Self::Id> + '_>;
    fn auth_events(&self) -> Box<dyn DoubleEndedIterator<Item = &Self::Id> + '_>;
    fn redacts(&self) -> Option<&Self::Id>;
}
Available on crate feature state-res only.
Expand description

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

Required Associated Types§

Required Methods§

Source

fn event_id(&self) -> &Self::Id

The EventId of this event.

Source

fn room_id(&self) -> &RoomId

The RoomId of this event.

Source

fn sender(&self) -> &UserId

The UserId of this event.

Source

fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch

The time of creation on the originating server.

Source

fn event_type(&self) -> &TimelineEventType

The event type.

Source

fn content(&self) -> &RawValue

The event’s content.

Source

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

The state key for this event.

Source

fn prev_events(&self) -> Box<dyn DoubleEndedIterator<Item = &Self::Id> + '_>

The events before this event.

Source

fn auth_events(&self) -> Box<dyn DoubleEndedIterator<Item = &Self::Id> + '_>

All the authenticating events for this event.

Source

fn redacts(&self) -> Option<&Self::Id>

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

Implementations on Foreign Types§

Source§

impl<T> Event for &T
where T: Event,

Source§

type Id = <T as Event>::Id

Source§

fn event_id(&self) -> &<&T as Event>::Id

Source§

fn room_id(&self) -> &RoomId

Source§

fn sender(&self) -> &UserId

Source§

fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch

Source§

fn event_type(&self) -> &TimelineEventType

Source§

fn content(&self) -> &RawValue

Source§

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

Source§

fn prev_events( &self, ) -> Box<dyn DoubleEndedIterator<Item = &<&T as Event>::Id> + '_>

Source§

fn auth_events( &self, ) -> Box<dyn DoubleEndedIterator<Item = &<&T as Event>::Id> + '_>

Source§

fn redacts(&self) -> Option<&<&T as Event>::Id>

Source§

impl<T> Event for Arc<T>
where T: Event,

Source§

type Id = <T as Event>::Id

Source§

fn event_id(&self) -> &<Arc<T> as Event>::Id

Source§

fn room_id(&self) -> &RoomId

Source§

fn sender(&self) -> &UserId

Source§

fn origin_server_ts(&self) -> MilliSecondsSinceUnixEpoch

Source§

fn event_type(&self) -> &TimelineEventType

Source§

fn content(&self) -> &RawValue

Source§

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

Source§

fn prev_events( &self, ) -> Box<dyn DoubleEndedIterator<Item = &<Arc<T> as Event>::Id> + '_>

Source§

fn auth_events( &self, ) -> Box<dyn DoubleEndedIterator<Item = &<Arc<T> as Event>::Id> + '_>

Source§

fn redacts(&self) -> Option<&<Arc<T> as Event>::Id>

Implementors§