Struct ruma_identifiers::EventId [] [src]

pub struct EventId { /* fields omitted */ }

A Matrix event ID.

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

assert_eq!(
    EventId::try_from("$h29iv0s8:example.com").unwrap().to_string(),
    "$h29iv0s8:example.com"
);

Methods

impl EventId
[src]

Attempts to generate an EventId 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.

Returns a Host for the event 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 event's opaque ID.

Returns the port the originating homeserver can be accessed on.

Trait Implementations

impl Clone for EventId
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for EventId
[src]

Formats the value using the given formatter.

impl Eq for EventId
[src]

impl Hash for EventId
[src]

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

Feeds a slice of this type into the state provided.

impl PartialEq for EventId
[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 EventId
[src]

Formats the value using the given formatter. Read more

impl Serialize for EventId
[src]

Serialize this value into the given Serde serializer. Read more

impl Deserialize for EventId
[src]

Deserialize this value from the given Serde deserializer. Read more

impl<'a> TryFrom<&'a str> for EventId
[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 event ID from a string representation.

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