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) -> &RawJsonValue;
    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>;
}
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) -> &RawJsonValue

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> Event for &T

Source§

type Id = <T as Event>::Id

Source§

fn event_id(&self) -> &Self::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) -> &RawJsonValue

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

type Id = <T as Event>::Id

Source§

fn event_id(&self) -> &Self::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) -> &RawJsonValue

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§