Enum ruma_identifiers::RoomIdOrAliasId
[−]
[src]
pub enum RoomIdOrAliasId { RoomAliasId(RoomAliasId), RoomId(RoomId), }
A Matrix room ID or a Matrix room alias ID.
RoomIdOrAliasId
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!( RoomIdOrAliasId::try_from("#ruma:example.com").unwrap().to_string(), "#ruma:example.com" ); assert_eq!( RoomIdOrAliasId::try_from("!n8f893n9:example.com").unwrap().to_string(), "!n8f893n9:example.com" );
Variants
RoomAliasId(RoomAliasId)
A Matrix room alias ID.
RoomId(RoomId)
A Matrix room ID.
Trait Implementations
impl Clone for RoomIdOrAliasId
[src]
fn clone(&self) -> RoomIdOrAliasId
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for RoomIdOrAliasId
[src]
impl Eq for RoomIdOrAliasId
[src]
impl Hash for RoomIdOrAliasId
[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 PartialEq for RoomIdOrAliasId
[src]
fn eq(&self, __arg_0: &RoomIdOrAliasId) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &RoomIdOrAliasId) -> bool
This method tests for !=
.
impl Display for RoomIdOrAliasId
[src]
fn fmt(&self, f: &mut Formatter) -> FmtResult
Formats the value using the given formatter. Read more
impl Serialize for RoomIdOrAliasId
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer
Serialize this value into the given Serde serializer. Read more
impl Deserialize for RoomIdOrAliasId
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer
Deserialize this value from the given Serde deserializer. Read more
impl<'a> TryFrom<&'a str> for RoomIdOrAliasId
[src]
type Error = Error
try_from
)The type returned in the event of a conversion error.
fn try_from(room_id_or_alias_id: &'a str) -> Result<Self, Error>
try_from
)Attempts to create a new Matrix room ID or a room alias ID from a string representation.
The string must either include the leading ! sigil, the opaque ID, a literal colon, and a valid server name or include the leading # sigil, the alias, a literal colon, and a valid server name.