logo
#[repr(transparent)]
pub struct RoomId(_);
Expand description

A Matrix room ID.

A RoomId is generated randomly or converted from a string slice, and can be converted back into a string as needed.

assert_eq!(<&RoomId>::try_from("!n8f893n9:example.com").unwrap(), "!n8f893n9:example.com");

Implementations

Try parsing a &str into a Box<RoomId>.

The same can also be done using FromStr, TryFrom or TryInto. This function is simply more constrained and thus useful in generic contexts.

Try parsing a &str into an Rc<RoomId>.

Try parsing a &str into an Arc<RoomId>.

Creates a string slice from this RoomId.

Creates a byte slice from this RoomId.

Available on crate feature rand only.

Attempts to generate a RoomId for the given origin server with a localpart consisting of 18 random ASCII characters.

Fails if the given homeserver cannot be parsed as a valid host.

Returns the rooms’s unique ID.

Returns the server name of the room ID.

Create a matrix.to URI for this room ID.

Example
use ruma_identifiers::{room_id, server_name};

assert_eq!(
    room_id!("!somewhere:example.org")
        .matrix_to_uri([&*server_name!("example.org"), &*server_name!("alt.example.org")])
        .to_string(),
    "https://matrix.to/#/%21somewhere%3Aexample.org?via=example.org&via=alt.example.org"
);

Create a matrix.to URI for an event scoped under this room ID.

Create a matrix: URI for this room ID.

If join is true, a click on the URI should join the room.

Example
use ruma_identifiers::{room_id, server_name};

assert_eq!(
    room_id!("!somewhere:example.org")
        .matrix_uri([&*server_name!("example.org"), &*server_name!("alt.example.org")], true)
        .to_string(),
    "matrix:roomid/somewhere:example.org?via=example.org&via=alt.example.org&action=join"
);

Create a matrix: URI for an event scoped under this room ID.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

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)

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.

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

Converts the given value to a String. Read more