Enum matrix_sdk::room::Room[][src]

pub enum Room {
    Joined(Joined),
    Left(Left),
    Invited(Invited),
}
Expand description

An enum that abstracts over the different states a room can be in.

Variants

Joined(Joined)

The room in the join state.

Tuple Fields of Joined

0: Joined
Left(Left)

The room in the left state.

Tuple Fields of Left

0: Left
Invited(Invited)

The room in the invited state.

Tuple Fields of Invited

0: Invited

Methods from Deref<Target = Common>

Gets the avatar of this room, if set.

Returns the avatar. If a thumbnail is requested no guarantee on the size of the image is given.

Arguments

  • format - The desired format of the avatar.

Example

let client = Client::new(homeserver).unwrap();
client.login(user, "password", None, None).await.unwrap();
let room_id = room_id!("!roomid:example.com");
let room = client
    .get_joined_room(&room_id)
    .unwrap();
if let Some(avatar) = room.avatar(MediaFormat::File).await.unwrap() {
    std::fs::write("avatar.png", avatar);
}

Sends a request to /_matrix/client/r0/rooms/{room_id}/messages and returns a get_message_events::Response that contains a chunk of room and state events (AnyRoomEvent and AnyStateEvent).

Arguments

  • request - The easiest way to create this request is using the get_message_events::Request itself.

Examples

use matrix_sdk::Client;

let room_id = room_id!("!roomid:example.com");
let request = MessagesRequest::backward(&room_id, "t47429-4392820_219380_26003_2265");

let mut client = Client::new(homeserver).unwrap();
assert!(room.messages(request).await.is_ok());

Sends a request to /_matrix/client/r0/rooms/{roomId}/event/{eventId} and returns a get_room_event::Response that contains a event (AnyRoomEvent).

Sync the member list with the server.

This method will de-duplicate requests if it is called multiple times in quick succession, in that case the return value will be None.

Get active members for this room, includes invited, joined members.

Note: This method will fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Because of that, it might panic if it isn’t run on a tokio thread.

Use active_members_no_sync() if you want a method that doesn’t do any requests.

Get active members for this room, includes invited, joined members.

Note: This method will fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Because of that, it might panic if it isn’t run on a tokio thread.

Use active_members() if you want to ensure to always get the full member list.

Get all the joined members of this room.

Note: This method will fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Because of that it might panic if it isn’t run on a tokio thread.

Use joined_members_no_sync() if you want a method that doesn’t do any requests.

Get all the joined members of this room.

Note: This method will not fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Thus, members could be missing from the list.

Use joined_members() if you want to ensure to always get the full member list.

Get a specific member of this room.

Note: This method will fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Because of that it might panic if it isn’t run on a tokio thread.

Use get_member_no_sync() if you want a method that doesn’t do any requests.

Arguments

  • user_id - The ID of the user that should be fetched out of the store.

Get a specific member of this room.

Note: This method will not fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Thus, members could be missing.

Use get_member() if you want to ensure to always have the full member list to chose from.

Arguments

  • user_id - The ID of the user that should be fetched out of the store.

Get all members for this room, includes invited, joined and left members.

Note: This method will fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Because of that it might panic if it isn’t run on a tokio thread.

Use members_no_sync() if you want a method that doesn’t do any requests.

Get all members for this room, includes invited, joined and left members.

Note: This method will not fetch the members from the homeserver if the member list isn’t synchronized due to member lazy loading. Thus, members could be missing.

Use members() if you want to ensure to always get the full member list.

Get all state events of a given type in this room.

Get a specific state event in this room.

This is supported on encryption only.

Check if all members of this room are verified and all their devices are verified.

Returns true if all devices in the room are verified, otherwise false.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

This event handler context argument is only applicable to room-specific events.

Trying to use it in the event handler for another event, for example a global account data or presence event, will result in the event handler being skipped and an error getting logged.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.