Struct ruma_identifiers::RoomIdOrAliasId [−][src]
pub struct RoomIdOrAliasId { /* fields omitted */ }
Expand description
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().as_ref(), "#ruma:example.com" ); assert_eq!( RoomIdOrAliasId::try_from("!n8f893n9:example.com").unwrap().as_ref(), "!n8f893n9:example.com" );
Implementations
impl RoomIdOrAliasId
[src]
impl RoomIdOrAliasId
[src]pub fn localpart(&self) -> &str
[src]
pub fn localpart(&self) -> &str
[src]Returns the local part (everything after the !
or #
and before the first colon).
pub fn server_name(&self) -> &ServerName
[src]
pub fn server_name(&self) -> &ServerName
[src]Returns the server name of the room (alias) ID.
pub fn is_room_id(&self) -> bool
[src]
pub fn is_room_id(&self) -> bool
[src]Whether this is a room id (starts with '!'
)
pub fn is_room_alias_id(&self) -> bool
[src]
pub fn is_room_alias_id(&self) -> bool
[src]Whether this is a room alias id (starts with '#'
)
pub fn into_either(self) -> Either<RoomId, RoomAliasId>
[src]
This is supported on crate feature either
only.
pub fn into_either(self) -> Either<RoomId, RoomAliasId>
[src]either
only.Turn this RoomIdOrAliasId
into Either<RoomId, RoomAliasId>
impl RoomIdOrAliasId
[src]
impl RoomIdOrAliasId
[src]pub fn into_string(self) -> String
[src]
pub fn into_string(self) -> String
[src]Converts this RoomIdOrAliasId
into a String
pub fn into_bytes(self) -> Vec<u8>
[src]
pub fn into_bytes(self) -> Vec<u8>
[src]Converts this RoomIdOrAliasId
into a Vec<u8>
Trait Implementations
impl Clone for RoomIdOrAliasId
[src]
impl Clone for RoomIdOrAliasId
[src]fn clone(&self) -> RoomIdOrAliasId
[src]
fn clone(&self) -> RoomIdOrAliasId
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for RoomIdOrAliasId
[src]
impl Debug for RoomIdOrAliasId
[src]impl<'de> Deserialize<'de> for RoomIdOrAliasId
[src]
impl<'de> Deserialize<'de> for RoomIdOrAliasId
[src]fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
impl Display for RoomIdOrAliasId
[src]
impl Display for RoomIdOrAliasId
[src]impl From<RoomAliasId> for RoomIdOrAliasId
[src]
impl From<RoomAliasId> for RoomIdOrAliasId
[src]fn from(_: RoomAliasId) -> Self
[src]
fn from(_: RoomAliasId) -> Self
[src]Performs the conversion.
impl FromStr for RoomIdOrAliasId
[src]
impl FromStr for RoomIdOrAliasId
[src]impl Hash for RoomIdOrAliasId
[src]
impl Hash for RoomIdOrAliasId
[src]impl Ord for RoomIdOrAliasId
[src]
impl Ord for RoomIdOrAliasId
[src]impl PartialEq<&'_ str> for RoomIdOrAliasId
[src]
impl PartialEq<&'_ str> for RoomIdOrAliasId
[src]impl PartialEq<RoomIdOrAliasId> for RoomIdOrAliasId
[src]
impl PartialEq<RoomIdOrAliasId> for RoomIdOrAliasId
[src]impl PartialEq<String> for RoomIdOrAliasId
[src]
impl PartialEq<String> for RoomIdOrAliasId
[src]impl PartialEq<str> for RoomIdOrAliasId
[src]
impl PartialEq<str> for RoomIdOrAliasId
[src]impl PartialOrd<RoomIdOrAliasId> for RoomIdOrAliasId
[src]
impl PartialOrd<RoomIdOrAliasId> for RoomIdOrAliasId
[src]fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Serialize for RoomIdOrAliasId
[src]
impl Serialize for RoomIdOrAliasId
[src]impl TryFrom<&'_ str> for RoomIdOrAliasId
[src]
impl TryFrom<&'_ str> for RoomIdOrAliasId
[src]impl TryFrom<RoomIdOrAliasId> for RoomId
[src]
impl TryFrom<RoomIdOrAliasId> for RoomId
[src]type Error = RoomAliasId
type Error = RoomAliasId
The type returned in the event of a conversion error.
fn try_from(id: RoomIdOrAliasId) -> Result<RoomId, RoomAliasId>
[src]
fn try_from(id: RoomIdOrAliasId) -> Result<RoomId, RoomAliasId>
[src]Performs the conversion.
impl TryFrom<RoomIdOrAliasId> for RoomAliasId
[src]
impl TryFrom<RoomIdOrAliasId> for RoomAliasId
[src]fn try_from(id: RoomIdOrAliasId) -> Result<RoomAliasId, RoomId>
[src]
fn try_from(id: RoomIdOrAliasId) -> Result<RoomAliasId, RoomId>
[src]Performs the conversion.
impl TryFrom<String> for RoomIdOrAliasId
[src]
impl TryFrom<String> for RoomIdOrAliasId
[src]impl Eq for RoomIdOrAliasId
[src]
Auto Trait Implementations
impl RefUnwindSafe for RoomIdOrAliasId
impl Send for RoomIdOrAliasId
impl Sync for RoomIdOrAliasId
impl Unpin for RoomIdOrAliasId
impl UnwindSafe for RoomIdOrAliasId
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,