Enum ruma_events::call::member::CallMemberEventContent
source · pub enum CallMemberEventContent {
LegacyContent(LegacyMembershipContent),
SessionContent(SessionMembershipData),
Empty(EmptyMembershipData),
}
Expand description
The member state event for a MatrixRTC session.
This is the object containing all the data related to a Matrix users participation in a MatrixRTC session.
This is a unit struct with the enum CallMemberEventContent
because a Ruma state event cannot
be an enum and we need this to be an untagged enum for parsing purposes. (see
CallMemberEventContent
)
This struct also exposes allows to call the methods from CallMemberEventContent
.
Variants§
LegacyContent(LegacyMembershipContent)
The legacy format for m.call.member events. (An array of memberships. The devices of one user.)
SessionContent(SessionMembershipData)
Normal membership events. One event per membership. Multiple state keys will be used to describe multiple devices for one user.
Empty(EmptyMembershipData)
An empty content means this user has been in a rtc session but is not anymore.
Implementations§
source§impl CallMemberEventContent
impl CallMemberEventContent
sourcepub fn new_legacy(memberships: Vec<LegacyMembershipData>) -> Self
pub fn new_legacy(memberships: Vec<LegacyMembershipData>) -> Self
Creates a new CallMemberEventContent
with LegacyMembershipData
.
sourcepub fn new(
application: Application,
device_id: OwnedDeviceId,
focus_active: ActiveFocus,
foci_preferred: Vec<Focus>,
created_ts: Option<MilliSecondsSinceUnixEpoch>,
) -> Self
pub fn new( application: Application, device_id: OwnedDeviceId, focus_active: ActiveFocus, foci_preferred: Vec<Focus>, created_ts: Option<MilliSecondsSinceUnixEpoch>, ) -> Self
Creates a new CallMemberEventContent
with SessionMembershipData
.
sourcepub fn new_empty(leave_reason: Option<LeaveReason>) -> Self
pub fn new_empty(leave_reason: Option<LeaveReason>) -> Self
Creates a new Empty CallMemberEventContent
representing a left membership.
sourcepub fn active_memberships(
&self,
origin_server_ts: Option<MilliSecondsSinceUnixEpoch>,
) -> Vec<MembershipData<'_>>
pub fn active_memberships( &self, origin_server_ts: Option<MilliSecondsSinceUnixEpoch>, ) -> Vec<MembershipData<'_>>
All non expired memberships in this member event.
In most cases you want to use this method instead of the public memberships field. The memberships field will also include expired events.
This copies all the memberships and converts them
§Arguments
origin_server_ts
- optionally theorigin_server_ts
can be passed as a fallback in the Membership does not containLegacyMembershipData::created_ts
. (origin_server_ts
will be ignored ifLegacyMembershipData::created_ts
isSome
)
sourcepub fn memberships(&self) -> Vec<MembershipData<'_>>
pub fn memberships(&self) -> Vec<MembershipData<'_>>
All the memberships for this event. Can only contain multiple elements in the case of legacy
m.call.member
state events.
sourcepub fn set_created_ts_if_none(
&mut self,
origin_server_ts: MilliSecondsSinceUnixEpoch,
)
pub fn set_created_ts_if_none( &mut self, origin_server_ts: MilliSecondsSinceUnixEpoch, )
Set the created_ts
of each MembershipData::Legacy
in this event.
Each call member event contains the origin_server_ts
and content.create_ts
.
content.create_ts
is undefined for the initial event of a session (because the
origin_server_ts
is not known on the client).
In the rust sdk we want to copy over the origin_server_ts
of the event into the content.
(This allows to use MinimalStateEvents
and still be able to determine if a membership is
expired)
Trait Implementations§
source§impl Clone for CallMemberEventContent
impl Clone for CallMemberEventContent
source§fn clone(&self) -> CallMemberEventContent
fn clone(&self) -> CallMemberEventContent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CallMemberEventContent
impl Debug for CallMemberEventContent
source§impl<'de> Deserialize<'de> for CallMemberEventContent
impl<'de> Deserialize<'de> for CallMemberEventContent
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl EventContent for CallMemberEventContent
impl EventContent for CallMemberEventContent
source§type EventType = StateEventType
type EventType = StateEventType
source§fn event_type(&self) -> Self::EventType
fn event_type(&self) -> Self::EventType
m.room.message
.source§impl From<CallMemberEventContent> for AnyStateEventContent
impl From<CallMemberEventContent> for AnyStateEventContent
source§fn from(c: CallMemberEventContent) -> Self
fn from(c: CallMemberEventContent) -> Self
source§impl PartialEq for CallMemberEventContent
impl PartialEq for CallMemberEventContent
source§impl RedactContent for CallMemberEventContent
impl RedactContent for CallMemberEventContent
source§type Redacted = RedactedCallMemberEventContent
type Redacted = RedactedCallMemberEventContent
source§impl Serialize for CallMemberEventContent
impl Serialize for CallMemberEventContent
source§impl StateEventContent for CallMemberEventContent
impl StateEventContent for CallMemberEventContent
source§type StateKey = CallMemberStateKey
type StateKey = CallMemberStateKey
state_key
field.source§impl StaticStateEventContent for CallMemberEventContent
impl StaticStateEventContent for CallMemberEventContent
source§type PossiblyRedacted = CallMemberEventContent
type PossiblyRedacted = CallMemberEventContent
source§type Unsigned = StateUnsigned<<CallMemberEventContent as StaticStateEventContent>::PossiblyRedacted>
type Unsigned = StateUnsigned<<CallMemberEventContent as StaticStateEventContent>::PossiblyRedacted>
unsigned
field.impl StructuralPartialEq for CallMemberEventContent
Auto Trait Implementations§
impl Freeze for CallMemberEventContent
impl RefUnwindSafe for CallMemberEventContent
impl Send for CallMemberEventContent
impl Sync for CallMemberEventContent
impl Unpin for CallMemberEventContent
impl UnwindSafe for CallMemberEventContent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)