Struct ruma_common::RoomAliasId
source · [−]#[repr(transparent)]pub struct RoomAliasId(_);
Expand description
A Matrix room alias ID.
A RoomAliasId
is converted from a string slice, and can be converted back into a string as
needed.
assert_eq!(<&RoomAliasId>::try_from("#ruma:example.com").unwrap(), "#ruma:example.com");
Implementations
sourceimpl RoomAliasId
impl RoomAliasId
sourceimpl RoomAliasId
impl RoomAliasId
sourcepub fn parse(s: impl AsRef<str>) -> Result<OwnedRoomAliasId, IdParseError>
pub fn parse(s: impl AsRef<str>) -> Result<OwnedRoomAliasId, IdParseError>
Try parsing a &str
into an OwnedRoomAliasId
.
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>>
) -> Result<Box<Self>, IdParseError>
pub fn parse_box(
s: impl AsRef<str> + Into<Box<str>>
) -> Result<Box<Self>, IdParseError>
Try parsing a &str
into a Box<RoomAliasId>
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
sourceimpl RoomAliasId
impl RoomAliasId
sourcepub fn server_name(&self) -> &ServerName
pub fn server_name(&self) -> &ServerName
Returns the server name of the room alias ID.
sourcepub fn matrix_to_uri(&self) -> MatrixToUri
pub fn matrix_to_uri(&self) -> MatrixToUri
Create a matrix.to
URI for this room alias ID.
sourcepub fn matrix_to_event_uri(&self, ev_id: &EventId) -> MatrixToUri
pub fn matrix_to_event_uri(&self, ev_id: &EventId) -> MatrixToUri
Create a matrix.to
URI for an event scoped under this room alias ID.
sourcepub fn matrix_uri(&self, join: bool) -> MatrixUri
pub fn matrix_uri(&self, join: bool) -> MatrixUri
Create a matrix:
URI for this room alias ID.
If join
is true
, a click on the URI should join the room.
sourcepub fn matrix_event_uri(&self, ev_id: &EventId) -> MatrixUri
pub fn matrix_event_uri(&self, ev_id: &EventId) -> MatrixUri
Create a matrix:
URI for an event scoped under this room alias ID.
Trait Implementations
sourceimpl AsRef<RoomAliasId> for OwnedRoomAliasId
impl AsRef<RoomAliasId> for OwnedRoomAliasId
sourcefn as_ref(&self) -> &RoomAliasId
fn as_ref(&self) -> &RoomAliasId
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl AsRef<str> for RoomAliasId
impl AsRef<str> for RoomAliasId
sourceimpl AsRef<str> for Box<RoomAliasId>
impl AsRef<str> for Box<RoomAliasId>
sourceimpl Borrow<RoomAliasId> for OwnedRoomAliasId
impl Borrow<RoomAliasId> for OwnedRoomAliasId
sourcefn borrow(&self) -> &RoomAliasId
fn borrow(&self) -> &RoomAliasId
Immutably borrows from an owned value. Read more
sourceimpl Clone for Box<RoomAliasId>
impl Clone for Box<RoomAliasId>
sourceimpl Debug for RoomAliasId
impl Debug for RoomAliasId
sourceimpl<'de> Deserialize<'de> for Box<RoomAliasId>
impl<'de> Deserialize<'de> for Box<RoomAliasId>
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for RoomAliasId
impl Display for RoomAliasId
sourceimpl<'a> From<&'a RoomAliasId> for &'a RoomOrAliasId
impl<'a> From<&'a RoomAliasId> for &'a RoomOrAliasId
sourcefn from(room_alias_id: &'a RoomAliasId) -> Self
fn from(room_alias_id: &'a RoomAliasId) -> Self
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for MatrixId
impl From<&RoomAliasId> for MatrixId
sourcefn from(room_alias: &RoomAliasId) -> Self
fn from(room_alias: &RoomAliasId) -> Self
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for OwnedRoomAliasId
impl From<&RoomAliasId> for OwnedRoomAliasId
sourcefn from(id: &RoomAliasId) -> OwnedRoomAliasId
fn from(id: &RoomAliasId) -> OwnedRoomAliasId
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for String
impl From<&RoomAliasId> for String
sourcefn from(id: &RoomAliasId) -> Self
fn from(id: &RoomAliasId) -> Self
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for Box<RoomAliasId>
impl From<&RoomAliasId> for Box<RoomAliasId>
sourcefn from(id: &RoomAliasId) -> Self
fn from(id: &RoomAliasId) -> Self
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for Rc<RoomAliasId>
impl From<&RoomAliasId> for Rc<RoomAliasId>
sourcefn from(s: &RoomAliasId) -> Rc<RoomAliasId>
fn from(s: &RoomAliasId) -> Rc<RoomAliasId>
Converts to this type from the input type.
sourceimpl From<&RoomAliasId> for Arc<RoomAliasId>
impl From<&RoomAliasId> for Arc<RoomAliasId>
sourcefn from(s: &RoomAliasId) -> Arc<RoomAliasId>
fn from(s: &RoomAliasId) -> Arc<RoomAliasId>
Converts to this type from the input type.
sourceimpl FromStr for Box<RoomAliasId>
impl FromStr for Box<RoomAliasId>
sourceimpl Hash for RoomAliasId
impl Hash for RoomAliasId
sourceimpl Ord for RoomAliasId
impl Ord for RoomAliasId
sourceimpl PartialEq<&RoomAliasId> for OwnedRoomAliasId
impl PartialEq<&RoomAliasId> for OwnedRoomAliasId
sourceimpl PartialEq<&RoomAliasId> for Box<RoomAliasId>
impl PartialEq<&RoomAliasId> for Box<RoomAliasId>
sourceimpl PartialEq<&str> for RoomAliasId
impl PartialEq<&str> for RoomAliasId
sourceimpl PartialEq<&str> for Box<RoomAliasId>
impl PartialEq<&str> for Box<RoomAliasId>
sourceimpl PartialEq<Box<RoomAliasId, Global>> for RoomAliasId
impl PartialEq<Box<RoomAliasId, Global>> for RoomAliasId
sourceimpl PartialEq<Box<RoomAliasId, Global>> for &RoomAliasId
impl PartialEq<Box<RoomAliasId, Global>> for &RoomAliasId
sourceimpl PartialEq<OwnedRoomAliasId> for RoomAliasId
impl PartialEq<OwnedRoomAliasId> for RoomAliasId
sourceimpl PartialEq<OwnedRoomAliasId> for &RoomAliasId
impl PartialEq<OwnedRoomAliasId> for &RoomAliasId
sourceimpl PartialEq<OwnedRoomAliasId> for Box<RoomAliasId>
impl PartialEq<OwnedRoomAliasId> for Box<RoomAliasId>
sourceimpl PartialEq<RoomAliasId> for RoomAliasId
impl PartialEq<RoomAliasId> for RoomAliasId
sourcefn eq(&self, other: &RoomAliasId) -> bool
fn eq(&self, other: &RoomAliasId) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RoomAliasId) -> bool
fn ne(&self, other: &RoomAliasId) -> bool
This method tests for !=
.
sourceimpl PartialEq<RoomAliasId> for OwnedRoomAliasId
impl PartialEq<RoomAliasId> for OwnedRoomAliasId
sourceimpl PartialEq<RoomAliasId> for Box<RoomAliasId>
impl PartialEq<RoomAliasId> for Box<RoomAliasId>
sourceimpl PartialEq<RoomAliasId> for str
impl PartialEq<RoomAliasId> for str
sourceimpl PartialEq<RoomAliasId> for &str
impl PartialEq<RoomAliasId> for &str
sourceimpl PartialEq<RoomAliasId> for String
impl PartialEq<RoomAliasId> for String
sourceimpl PartialEq<String> for RoomAliasId
impl PartialEq<String> for RoomAliasId
sourceimpl PartialEq<String> for Box<RoomAliasId>
impl PartialEq<String> for Box<RoomAliasId>
sourceimpl PartialEq<str> for RoomAliasId
impl PartialEq<str> for RoomAliasId
sourceimpl PartialEq<str> for Box<RoomAliasId>
impl PartialEq<str> for Box<RoomAliasId>
sourceimpl PartialOrd<RoomAliasId> for RoomAliasId
impl PartialOrd<RoomAliasId> for RoomAliasId
sourcefn partial_cmp(&self, other: &RoomAliasId) -> Option<Ordering>
fn partial_cmp(&self, other: &RoomAliasId) -> 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 RoomAliasId
impl Serialize for RoomAliasId
sourceimpl ToOwned for RoomAliasId
impl ToOwned for RoomAliasId
type Owned = OwnedRoomAliasId
type Owned = OwnedRoomAliasId
The resulting type after obtaining ownership.
sourcefn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::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 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 RoomAliasId
impl<'a> TryFrom<&'a str> for &'a RoomAliasId
sourceimpl TryFrom<&str> for Box<RoomAliasId>
impl TryFrom<&str> for Box<RoomAliasId>
sourceimpl TryFrom<String> for Box<RoomAliasId>
impl TryFrom<String> for Box<RoomAliasId>
impl Eq for RoomAliasId
impl StructuralEq for RoomAliasId
impl StructuralPartialEq for RoomAliasId
Auto Trait Implementations
impl RefUnwindSafe for RoomAliasId
impl Send for RoomAliasId
impl !Sized for RoomAliasId
impl Sync for RoomAliasId
impl Unpin for RoomAliasId
impl UnwindSafe for RoomAliasId
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.