matrix_sdk_base

Struct RoomInfo

Source
pub struct RoomInfo { /* private fields */ }
Expand description

The underlying pure data structure for joined and left rooms.

Holds all the info needed to persist a room into the state store.

Implementations§

Source§

impl RoomInfo

Source

pub fn mark_as_joined(&mut self)

Mark this Room as joined.

Source

pub fn mark_as_left(&mut self)

Mark this Room as left.

Source

pub fn mark_as_invited(&mut self)

Mark this Room as invited.

Source

pub fn mark_as_knocked(&mut self)

Mark this Room as knocked.

Source

pub fn mark_as_banned(&mut self)

Mark this Room as banned.

Source

pub fn set_state(&mut self, room_state: RoomState)

Set the membership RoomState of this Room

Source

pub fn mark_members_synced(&mut self)

Mark this Room as having all the members synced.

Source

pub fn mark_members_missing(&mut self)

Mark this Room as still missing member information.

Source

pub fn are_members_synced(&self) -> bool

Returns whether the room members are synced.

Source

pub fn mark_state_partially_synced(&mut self)

Mark this Room as still missing some state information.

Source

pub fn mark_state_fully_synced(&mut self)

Mark this Room as still having all state synced.

Source

pub fn mark_state_not_synced(&mut self)

Mark this Room as still having no state synced.

Source

pub fn mark_encryption_state_synced(&mut self)

Mark this Room as having the encryption state synced.

Source

pub fn mark_encryption_state_missing(&mut self)

Mark this Room as still missing encryption state information.

Source

pub fn set_prev_batch(&mut self, prev_batch: Option<&str>) -> bool

Set the prev_batch-token. Returns whether the token has differed and thus has been upgraded: false means no update was applied as the were the same

Source

pub fn state(&self) -> RoomState

Returns the state this room is in.

Source

pub fn is_encrypted(&self) -> bool

Returns whether this is an encrypted room.

Source

pub fn set_encryption_event( &mut self, event: Option<RoomEncryptionEventContent>, )

Set the encryption event content in this room.

Source

pub fn handle_state_event(&mut self, event: &AnySyncStateEvent) -> bool

Handle the given state event.

Returns true if the event modified the info, false otherwise.

Source

pub fn handle_stripped_state_event( &mut self, event: &AnyStrippedStateEvent, ) -> bool

Handle the given stripped state event.

Returns true if the event modified the info, false otherwise.

Source

pub fn handle_redaction( &mut self, event: &SyncRoomRedactionEvent, _raw: &Raw<SyncRoomRedactionEvent>, )

Handle the given redaction.

Source

pub fn avatar_url(&self) -> Option<&MxcUri>

Returns the current room avatar.

Source

pub fn update_avatar(&mut self, url: Option<OwnedMxcUri>)

Update the room avatar.

Source

pub fn avatar_info(&self) -> Option<&ImageInfo>

Returns information about the current room avatar.

Source

pub fn update_notification_count( &mut self, notification_counts: UnreadNotificationsCount, )

Update the notifications count.

Source

pub fn update_from_ruma_summary(&mut self, summary: &RumaSummary) -> bool

Update the RoomSummary from a Ruma RoomSummary.

Returns true if any field has been updated, false otherwise.

Source

pub fn heroes(&self) -> &[RoomHero]

The heroes for this room.

Source

pub fn active_members_count(&self) -> u64

The number of active members (invited + joined) in the room.

The return value is saturated at u64::MAX.

Source

pub fn invited_members_count(&self) -> u64

The number of invited members in the room

Source

pub fn joined_members_count(&self) -> u64

The number of joined members in the room

Source

pub fn canonical_alias(&self) -> Option<&RoomAliasId>

Get the canonical alias of this room.

Source

pub fn alt_aliases(&self) -> &[OwnedRoomAliasId]

Get the alternative aliases of this room.

Source

pub fn room_id(&self) -> &RoomId

Get the room ID of this room.

Source

pub fn room_version(&self) -> Option<&RoomVersionId>

Get the room version of this room.

Source

pub fn room_version_or_default(&self) -> RoomVersionId

Get the room version of this room, or a sensible default.

Will warn (at most once) if the room creation event is missing from this RoomInfo.

Source

pub fn room_type(&self) -> Option<&RoomType>

Get the room type of this room.

Source

pub fn creator(&self) -> Option<&UserId>

Get the creator of this room.

Source

pub fn history_visibility(&self) -> Option<&HistoryVisibility>

Returns the history visibility for this room.

Returns None if the event was never seen during sync.

Source

pub fn history_visibility_or_default(&self) -> &HistoryVisibility

Returns the history visibility for this room, or a sensible default.

Returns Shared, the default specified by the spec, when the event is missing.

Source

pub fn join_rule(&self) -> &JoinRule

Returns the join rule for this room.

Defaults to Public, if missing.

Source

pub fn name(&self) -> Option<&str>

Get the name of this room.

Source

pub fn topic(&self) -> Option<&str>

Returns the topic for this room, if set.

Source

pub fn has_active_room_call(&self) -> bool

Is there a non expired membership with application “m.call” and scope “m.room” in this room.

Source

pub fn active_room_call_participants(&self) -> Vec<OwnedUserId>

Returns a Vec of userId’s that participate in the room call.

matrix_rtc memberships with application “m.call” and scope “m.room” are considered. A user can occur twice if they join with two devices. convert to a set depending if the different users are required or the amount of sessions.

The vector is ordered by oldest membership user to newest.

Source

pub fn latest_event(&self) -> Option<&LatestEvent>

Available on crate feature experimental-sliding-sync only.

Returns the latest (decrypted) event recorded for this room.

Source

pub fn pinned_event_ids(&self) -> Option<Vec<OwnedEventId>>

Returns the current pinned event ids for this room.

Source

pub fn is_pinned_event(&self, event_id: &EventId) -> bool

Checks if an EventId is currently pinned. It avoids having to clone the whole list of event ids to check a single value.

Returns true if the provided event_id is pinned, false otherwise.

Trait Implementations§

Source§

impl Clone for RoomInfo

Source§

fn clone(&self) -> RoomInfo

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RoomInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RoomInfo

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RoomInfo

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<>
Source§

fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
Source§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

impl<T> Identity for T
where T: ?Sized,

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> AsyncTraitDeps for T

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

§

impl<T> SendOutsideWasm for T
where T: Send,

§

impl<T> SyncOutsideWasm for T
where T: Sync,