[][src]Struct ruma_identifiers::RoomId

pub struct RoomId { /* fields omitted */ }

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().as_ref(),
    "!n8f893n9:example.com"
);

Implementations

impl RoomId[src]

pub fn new(server_name: &ServerName) -> Self[src]

This is supported on 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.

impl RoomId[src]

pub fn localpart(&self) -> &str[src]

Returns the rooms's unique ID.

pub fn server_name(&self) -> &ServerName[src]

Returns the server name of the room ID.

impl RoomId[src]

pub fn as_str(&self) -> &str[src]

Creates a string slice from this RoomId

pub fn as_bytes(&self) -> &[u8][src]

Creates a byte slice from this RoomId

Trait Implementations

impl AsRef<str> for RoomId[src]

impl Clone for RoomId[src]

impl Debug for RoomId[src]

impl<'de> Deserialize<'de> for RoomId[src]

impl Display for RoomId[src]

impl Eq for RoomId[src]

impl From<RoomId> for String[src]

impl From<RoomId> for RoomIdOrAliasId[src]

impl Hash for RoomId[src]

impl Ord for RoomId[src]

impl<'_> PartialEq<&'_ str> for RoomId[src]

impl PartialEq<RoomId> for RoomId[src]

impl PartialEq<RoomId> for str[src]

impl<'_> PartialEq<RoomId> for &'_ str[src]

impl PartialEq<RoomId> for String[src]

impl PartialEq<String> for RoomId[src]

impl PartialEq<str> for RoomId[src]

impl PartialOrd<RoomId> for RoomId[src]

impl Serialize for RoomId[src]

impl<'_> TryFrom<&'_ str> for RoomId[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<RoomIdOrAliasId> for RoomId[src]

type Error = RoomAliasId

The type returned in the event of a conversion error.

impl TryFrom<String> for RoomId[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for RoomId

impl Send for RoomId

impl Sync for RoomId

impl Unpin for RoomId

impl UnwindSafe for RoomId

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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