[][src]Struct ruma_events::room::member::MemberEvent

pub struct MemberEvent {
    pub content: MemberEventContent,
    pub event_id: EventId,
    pub origin_server_ts: UInt,
    pub prev_content: Option<MemberEventContent>,
    pub room_id: Option<RoomId>,
    pub sender: UserId,
    pub state_key: String,
    pub unsigned: Option<Value>,
}

The current membership state of a user in the room.

Adjusts the membership state for a user in a room. It is preferable to use the membership APIs (/rooms/<room id>/invite etc) when performing membership actions rather than adjusting the state directly as there are a restricted set of valid transformations. For example, user A cannot force user B to join a room, and trying to force this state change directly will fail.

The third_party_invite property will be set if this invite is an invite event and is the successor of an m.room.third_party_invite event, and absent otherwise.

This event may also include an invite_room_state key inside the event's unsigned data. If present, this contains an array of StrippedState events. These events provide information on a subset of state events such as the room name. Note that ruma-events treats unsigned data on events as arbitrary JSON values, and the ruma-events types for this event don't provide direct access to invite_room_state. If you need this data, you must extract and convert it from a serde_json::Value yourself.

The user for which a membership applies is represented by the state_key. Under some conditions, the sender and state_key may not match - this may be interpreted as the sender affecting the membership state of the state_key user.

The membership for a given user can change over time. Previous membership can be retrieved from the prev_content object on an event. If not present, the user's previous membership must be assumed as leave.

Fields

content: MemberEventContent

The event's content.

event_id: EventId

The unique identifier for the event.

origin_server_ts: UInt

Timestamp (milliseconds since the UNIX epoch) on originating homeserver when this event was sent.

prev_content: Option<MemberEventContent>

The previous content for this state key, if any.

room_id: Option<RoomId>

The unique identifier for the room associated with this event.

sender: UserId

The unique identifier for the user who sent this event.

state_key: String

A key that determines which piece of room state the event represents.

unsigned: Option<Value>

Additional key-value pairs not signed by the homeserver.

Trait Implementations

impl Event for MemberEvent[src]

type Content = MemberEventContent

The type of this event's content field.

fn content(&self) -> &Self::Content[src]

The event's content.

fn event_type(&self) -> EventType[src]

The type of the event.

impl RoomEvent for MemberEvent[src]

fn event_id(&self) -> &EventId[src]

The unique identifier for the event.

fn origin_server_ts(&self) -> UInt[src]

Timestamp (milliseconds since the UNIX epoch) on originating homeserver when this event was sent.

fn room_id(&self) -> Option<&RoomId>[src]

The unique identifier for the room associated with this event.

This can be None if the event came from a context where there is no ambiguity which room it belongs to, like a /sync response for example.

fn sender(&self) -> &UserId[src]

The unique identifier for the user who sent this event.

fn unsigned(&self) -> Option<&Value>[src]

Additional key-value pairs not signed by the homeserver.

impl StateEvent for MemberEvent[src]

fn prev_content(&self) -> Option<&Self::Content>[src]

The previous content for this state key, if any.

fn state_key(&self) -> &str[src]

A key that determines which piece of room state the event represents.

impl Clone for MemberEvent[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<MemberEvent> for MemberEvent[src]

impl From<MemberEvent> for Event[src]

impl From<MemberEvent> for RoomEvent[src]

impl From<MemberEvent> for StateEvent[src]

impl Debug for MemberEvent[src]

impl<'a> TryFrom<&'a str> for MemberEvent[src]

type Error = InvalidEvent

The type returned in the event of a conversion error.

fn try_from(json: &'a str) -> Result<Self, Self::Error>[src]

Attempt to create Self from parsing a string of JSON data.

impl FromStr for MemberEvent[src]

type Err = InvalidEvent

The associated error which can be returned from parsing.

fn from_str(json: &str) -> Result<Self, Self::Err>[src]

Attempt to create Self from parsing a string of JSON data.

impl Serialize for MemberEvent[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,