Struct ruma_identifiers::RoomId [] [src]

pub struct RoomId {
    // some 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().to_string(),
    "!n8f893n9:example.com"
);

Methods

impl RoomId
[src]

fn new(server_name: &str) -> Result<Self, Error>

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

Fails if the given origin server name cannot be parsed as a valid host.

fn hostname(&self) -> &Host

Returns a Host for the room ID, containing the server name (minus the port) of the originating homeserver.

The host can be either a domain name, an IPv4 address, or an IPv6 address.

fn opaque_id(&self) -> &str

Returns the event's opaque ID.

fn port(&self) -> u16

Returns the port the originating homeserver can be accessed on.

Trait Implementations

impl PartialEq for RoomId
[src]

fn eq(&self, __arg_0: &RoomId) -> bool

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

fn ne(&self, __arg_0: &RoomId) -> bool

This method tests for !=.

impl Hash for RoomId
[src]

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

Feeds this value into the state given, updating the hasher as necessary.

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0

Feeds a slice of this type into the state provided.

impl Eq for RoomId
[src]

impl Debug for RoomId
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Display for RoomId
[src]

fn fmt(&self, f: &mut Formatter) -> FmtResult

Formats the value using the given formatter.

impl Serialize for RoomId
[src]

fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer

Serializes this value into this serializer.

impl Deserialize for RoomId
[src]

fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer

Deserialize this value given this Deserializer.

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

type Err = Error

Unstable (try_from)

The type returned in the event of a conversion error.

fn try_from(room_id: &'a str) -> Result<Self, Error>

Unstable (try_from)

Attempts to create a new Matrix room ID from a string representation.

The string must include the leading ! sigil, the opaque ID, a literal colon, and a valid server name.