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

A Matrix room ID or a Matrix room alias ID.

RoomOrAliasId is useful for APIs that accept either kind of room identifier. It is converted from a string slice, and can be converted back into a string as needed. When converted from a string slice, the variant is determined by the leading sigil character.

assert_eq!(<&RoomOrAliasId>::try_from("#ruma:example.com").unwrap(), "#ruma:example.com");

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

Implementations

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

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<RoomOrAliasId>.

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

Creates a string slice from this RoomOrAliasId.

Creates a byte slice from this RoomOrAliasId.

Returns the local part (everything after the ! or # and before the first colon).

Returns the server name of the room (alias) ID.

Whether this is a room id (starts with '!')

Whether this is a room alias id (starts with '#')

Available on crate feature either only.

Turn this RoomOrAliasId into Either<RoomId, RoomAliasId>

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.

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