Struct ruma::RoomOrAliasId 
source · [−]#[repr(transparent)]pub struct RoomOrAliasId(_);Expand description
A Matrix room ID or a Matrix room alias ID.
RoomOrAliasId 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!(<&RoomOrAliasId>::try_from("#ruma:example.com").unwrap(), "#ruma:example.com");
assert_eq!(
    <&RoomOrAliasId>::try_from("!n8f893n9:example.com").unwrap(),
    "!n8f893n9:example.com"
);Implementations
sourceimpl RoomOrAliasId
 
impl RoomOrAliasId
sourceimpl RoomOrAliasId
 
impl RoomOrAliasId
sourcepub fn parse(s: impl AsRef<str>) -> Result<OwnedRoomOrAliasId, Error>
 
pub fn parse(s: impl AsRef<str>) -> Result<OwnedRoomOrAliasId, Error>
Try parsing a &str into an OwnedRoomOrAliasId.
The same can also be done using FromStr, TryFrom or TryInto.
This function is simply more constrained and thus useful in generic contexts.
sourcepub fn parse_box(
    s: impl AsRef<str> + Into<Box<str, Global>>
) -> Result<Box<RoomOrAliasId, Global>, Error>
 
pub fn parse_box(
    s: impl AsRef<str> + Into<Box<str, Global>>
) -> Result<Box<RoomOrAliasId, Global>, Error>
Try parsing a &str into a Box<RoomOrAliasId>.
The same can also be done using FromStr, TryFrom or TryInto.
This function is simply more constrained and thus useful in generic contexts.
sourceimpl RoomOrAliasId
 
impl RoomOrAliasId
sourcepub fn localpart(&self) -> &str
 
pub fn localpart(&self) -> &str
Returns the local part (everything after the ! or # and before the first colon).
sourcepub fn server_name(&self) -> &ServerName
 
pub fn server_name(&self) -> &ServerName
Returns the server name of the room (alias) ID.
sourcepub fn is_room_id(&self) -> bool
 
pub fn is_room_id(&self) -> bool
Whether this is a room id (starts with '!')
sourcepub fn is_room_alias_id(&self) -> bool
 
pub fn is_room_alias_id(&self) -> bool
Whether this is a room alias id (starts with '#')
Trait Implementations
sourceimpl AsRef<RoomOrAliasId> for OwnedRoomOrAliasId
 
impl AsRef<RoomOrAliasId> for OwnedRoomOrAliasId
sourcefn as_ref(&self) -> &RoomOrAliasId
 
fn as_ref(&self) -> &RoomOrAliasId
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl AsRef<str> for RoomOrAliasId
 
impl AsRef<str> for RoomOrAliasId
sourceimpl Borrow<RoomOrAliasId> for OwnedRoomOrAliasId
 
impl Borrow<RoomOrAliasId> for OwnedRoomOrAliasId
sourcefn borrow(&self) -> &RoomOrAliasId
 
fn borrow(&self) -> &RoomOrAliasId
Immutably borrows from an owned value. Read more
sourceimpl Clone for Box<RoomOrAliasId, Global>
 
impl Clone for Box<RoomOrAliasId, Global>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for RoomOrAliasId
 
impl Debug for RoomOrAliasId
sourceimpl<'de> Deserialize<'de> for Box<RoomOrAliasId, Global>
 
impl<'de> Deserialize<'de> for Box<RoomOrAliasId, Global>
sourcefn deserialize<D>(
    deserializer: D
) -> Result<Box<RoomOrAliasId, Global>, <D as Deserializer<'de>>::Error> where
    D: Deserializer<'de>, 
 
fn deserialize<D>(
    deserializer: D
) -> Result<Box<RoomOrAliasId, Global>, <D as Deserializer<'de>>::Error> where
    D: Deserializer<'de>, 
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for RoomOrAliasId
 
impl Display for RoomOrAliasId
sourceimpl<'a> From<&'a RoomAliasId> for &'a RoomOrAliasId
 
impl<'a> From<&'a RoomAliasId> for &'a RoomOrAliasId
sourcefn from(room_alias_id: &'a RoomAliasId) -> &'a RoomOrAliasId
 
fn from(room_alias_id: &'a RoomAliasId) -> &'a RoomOrAliasId
Converts to this type from the input type.
sourceimpl<'a> From<&'a RoomId> for &'a RoomOrAliasId
 
impl<'a> From<&'a RoomId> for &'a RoomOrAliasId
sourcefn from(room_id: &'a RoomId) -> &'a RoomOrAliasId
 
fn from(room_id: &'a RoomId) -> &'a RoomOrAliasId
Converts to this type from the input type.
sourceimpl<'_> From<&RoomOrAliasId> for Rc<RoomOrAliasId>
 
impl<'_> From<&RoomOrAliasId> for Rc<RoomOrAliasId>
sourcefn from(s: &RoomOrAliasId) -> Rc<RoomOrAliasId>
 
fn from(s: &RoomOrAliasId) -> Rc<RoomOrAliasId>
Converts to this type from the input type.
sourceimpl<'_> From<&RoomOrAliasId> for OwnedRoomOrAliasId
 
impl<'_> From<&RoomOrAliasId> for OwnedRoomOrAliasId
sourcefn from(id: &RoomOrAliasId) -> OwnedRoomOrAliasId
 
fn from(id: &RoomOrAliasId) -> OwnedRoomOrAliasId
Converts to this type from the input type.
sourceimpl<'_> From<&RoomOrAliasId> for Box<RoomOrAliasId, Global>
 
impl<'_> From<&RoomOrAliasId> for Box<RoomOrAliasId, Global>
sourcefn from(id: &RoomOrAliasId) -> Box<RoomOrAliasId, Global>
 
fn from(id: &RoomOrAliasId) -> Box<RoomOrAliasId, Global>
Converts to this type from the input type.
sourceimpl<'_> From<&RoomOrAliasId> for Arc<RoomOrAliasId>
 
impl<'_> From<&RoomOrAliasId> for Arc<RoomOrAliasId>
sourcefn from(s: &RoomOrAliasId) -> Arc<RoomOrAliasId>
 
fn from(s: &RoomOrAliasId) -> Arc<RoomOrAliasId>
Converts to this type from the input type.
sourceimpl<'_> From<&RoomOrAliasId> for String
 
impl<'_> From<&RoomOrAliasId> for String
sourcefn from(id: &RoomOrAliasId) -> String
 
fn from(id: &RoomOrAliasId) -> String
Converts to this type from the input type.
sourceimpl Hash for RoomOrAliasId
 
impl Hash for RoomOrAliasId
sourceimpl Ord for RoomOrAliasId
 
impl Ord for RoomOrAliasId
sourceimpl<'_> PartialEq<&RoomOrAliasId> for OwnedRoomOrAliasId
 
impl<'_> PartialEq<&RoomOrAliasId> for OwnedRoomOrAliasId
sourceimpl<'_> PartialEq<&str> for RoomOrAliasId
 
impl<'_> PartialEq<&str> for RoomOrAliasId
sourceimpl<'_> PartialEq<Box<RoomOrAliasId, Global>> for &RoomOrAliasId
 
impl<'_> PartialEq<Box<RoomOrAliasId, Global>> for &RoomOrAliasId
sourceimpl PartialEq<Box<RoomOrAliasId, Global>> for RoomOrAliasId
 
impl PartialEq<Box<RoomOrAliasId, Global>> for RoomOrAliasId
sourceimpl<'_> PartialEq<OwnedRoomOrAliasId> for &RoomOrAliasId
 
impl<'_> PartialEq<OwnedRoomOrAliasId> for &RoomOrAliasId
sourceimpl PartialEq<OwnedRoomOrAliasId> for RoomOrAliasId
 
impl PartialEq<OwnedRoomOrAliasId> for RoomOrAliasId
sourceimpl PartialEq<RoomOrAliasId> for RoomOrAliasId
 
impl PartialEq<RoomOrAliasId> for RoomOrAliasId
sourcefn eq(&self, other: &RoomOrAliasId) -> bool
 
fn eq(&self, other: &RoomOrAliasId) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &RoomOrAliasId) -> bool
 
fn ne(&self, other: &RoomOrAliasId) -> bool
This method tests for !=.
sourceimpl PartialEq<RoomOrAliasId> for OwnedRoomOrAliasId
 
impl PartialEq<RoomOrAliasId> for OwnedRoomOrAliasId
sourceimpl<'_> PartialEq<RoomOrAliasId> for &str
 
impl<'_> PartialEq<RoomOrAliasId> for &str
sourceimpl PartialEq<RoomOrAliasId> for str
 
impl PartialEq<RoomOrAliasId> for str
sourceimpl PartialEq<String> for RoomOrAliasId
 
impl PartialEq<String> for RoomOrAliasId
sourceimpl PartialEq<str> for RoomOrAliasId
 
impl PartialEq<str> for RoomOrAliasId
sourceimpl PartialOrd<RoomOrAliasId> for RoomOrAliasId
 
impl PartialOrd<RoomOrAliasId> for RoomOrAliasId
sourcefn partial_cmp(&self, other: &RoomOrAliasId) -> Option<Ordering>
 
fn partial_cmp(&self, other: &RoomOrAliasId) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
 
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
sourceimpl Serialize for RoomOrAliasId
 
impl Serialize for RoomOrAliasId
sourcefn serialize<S>(
    &self, 
    serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
    S: Serializer, 
 
fn serialize<S>(
    &self, 
    serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
    S: Serializer, 
Serialize this value into the given Serde serializer. Read more
sourceimpl ToOwned for RoomOrAliasId
 
impl ToOwned for RoomOrAliasId
type Owned = OwnedRoomOrAliasId
type Owned = OwnedRoomOrAliasId
The resulting type after obtaining ownership.
sourcefn to_owned(&self) -> <RoomOrAliasId as ToOwned>::Owned
 
fn to_owned(&self) -> <RoomOrAliasId as ToOwned>::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · sourcefn clone_into(&self, target: &mut Self::Owned)
 
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<'a> TryFrom<&'a RoomOrAliasId> for &'a RoomId
 
impl<'a> TryFrom<&'a RoomOrAliasId> for &'a RoomId
type Error = &'a RoomAliasId
type Error = &'a RoomAliasId
The type returned in the event of a conversion error.
sourcefn try_from(id: &'a RoomOrAliasId) -> Result<&'a RoomId, &'a RoomAliasId>
 
fn try_from(id: &'a RoomOrAliasId) -> Result<&'a RoomId, &'a RoomAliasId>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a RoomOrAliasId> for &'a RoomAliasId
 
impl<'a> TryFrom<&'a RoomOrAliasId> for &'a RoomAliasId
sourcefn try_from(id: &'a RoomOrAliasId) -> Result<&'a RoomAliasId, &'a RoomId>
 
fn try_from(id: &'a RoomOrAliasId) -> Result<&'a RoomAliasId, &'a RoomId>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a str> for &'a RoomOrAliasId
 
impl<'a> TryFrom<&'a str> for &'a RoomOrAliasId
impl Eq for RoomOrAliasId
impl StructuralEq for RoomOrAliasId
impl StructuralPartialEq for RoomOrAliasId
Auto Trait Implementations
impl RefUnwindSafe for RoomOrAliasId
impl Send for RoomOrAliasId
impl !Sized for RoomOrAliasId
impl Sync for RoomOrAliasId
impl Unpin for RoomOrAliasId
impl UnwindSafe for RoomOrAliasId
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
    T: Hash + ?Sized, 
 
impl<T> CallHasher for T where
    T: Hash + ?Sized, 
sourceimpl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
 
impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
sourcefn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.
