Struct ruma_identifiers::UserId [] [src]

pub struct UserId { /* fields omitted */ }

A Matrix user ID.

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

assert_eq!(
    UserId::try_from("@carl:example.com").unwrap().to_string(),
    "@carl:example.com"
);

Methods

impl UserId
[src]

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

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

Returns a Host for the user 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.

Returns the user's localpart.

Returns the port the originating homeserver can be accessed on.

Trait Implementations

impl Clone for UserId
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for UserId
[src]

Formats the value using the given formatter.

impl Eq for UserId
[src]

impl Hash for UserId
[src]

Feeds this value into the given [Hasher]. Read more

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

impl PartialEq for UserId
[src]

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

This method tests for !=.

impl Display for UserId
[src]

Formats the value using the given formatter. Read more

impl Serialize for UserId
[src]

Serialize this value into the given Serde serializer. Read more

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

Deserialize this value from the given Serde deserializer. Read more

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

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

The type returned in the event of a conversion error.

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

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

The string must include the leading @ sigil, the localpart, a literal colon, and a valid server name.