pub struct OwnedRoomId { /* private fields */ }Expand description
Owned variant of RoomId
The wrapper type for this type is variable, by default it’ll use Box,
but you can change that by setting “--cfg=ruma_identifiers_storage=...” using
RUSTFLAGS or .cargo/config.toml (under [build] -> rustflags = ["..."])
to the following;
ruma_identifiers_storage="Arc"to useArcas a wrapper type.
Methods from Deref<Target = RoomId>§
Sourcepub fn as_str(&self) -> &str
 Available on crate feature events only.
pub fn as_str(&self) -> &str
events only.Creates a string slice from this RoomId.
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
 Available on crate feature events only.
pub fn as_bytes(&self) -> &[u8] ⓘ
events only.Creates a byte slice from this RoomId.
Sourcepub fn strip_sigil(&self) -> &str
 Available on crate feature events only.
pub fn strip_sigil(&self) -> &str
events only.Returns the room ID without the initial ! sigil.
For room versions using RoomIdFormatVersion::V2, this is the reference hash of the
m.room.create event of the room.
Sourcepub fn server_name(&self) -> Option<&ServerName>
 Available on crate feature events only.
pub fn server_name(&self) -> Option<&ServerName>
events only.Returns the server name of the room ID, if it has the format !localpart:server_name.
This should only return Some(_) for room versions using RoomIdFormatVersion::V1.
Sourcepub fn matrix_to_uri(&self) -> MatrixToUri
 Available on crate feature events only.
pub fn matrix_to_uri(&self) -> MatrixToUri
events only.Create a matrix.to URI for this room ID.
Note that it is recommended to provide servers that should know the room to be able to find
it with its room ID. For that use RoomId::matrix_to_uri_via().
§Example
use ruma_common::{room_id, server_name};
assert_eq!(
    room_id!("!somewhere:example.org").matrix_to_uri().to_string(),
    "https://matrix.to/#/!somewhere:example.org"
);Sourcepub fn matrix_to_uri_via<T>(&self, via: T) -> MatrixToUri
 Available on crate feature events only.
pub fn matrix_to_uri_via<T>(&self, via: T) -> MatrixToUri
events only.Create a matrix.to URI for this room ID with a list of servers that should know it.
To get the list of servers, it is recommended to use the routing algorithm from the spec.
If you don’t have a list of servers, you can use RoomId::matrix_to_uri() instead.
§Example
use ruma_common::{room_id, server_name};
assert_eq!(
    room_id!("!somewhere:example.org")
        .matrix_to_uri_via([&*server_name!("example.org"), &*server_name!("alt.example.org")])
        .to_string(),
    "https://matrix.to/#/!somewhere:example.org?via=example.org&via=alt.example.org"
);Sourcepub fn matrix_to_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixToUri
 Available on crate feature events only.
pub fn matrix_to_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixToUri
events only.Create a matrix.to URI for an event scoped under this room ID.
Note that it is recommended to provide servers that should know the room to be able to find
it with its room ID. For that use RoomId::matrix_to_event_uri_via().
Sourcepub fn matrix_to_event_uri_via<T>(
    &self,
    ev_id: impl Into<OwnedEventId>,
    via: T,
) -> MatrixToUri
 Available on crate feature events only.
pub fn matrix_to_event_uri_via<T>( &self, ev_id: impl Into<OwnedEventId>, via: T, ) -> MatrixToUri
events only.Create a matrix.to URI for an event scoped under this room ID with a list of servers that
should know it.
To get the list of servers, it is recommended to use the routing algorithm from the spec.
If you don’t have a list of servers, you can use RoomId::matrix_to_event_uri() instead.
Sourcepub fn matrix_uri(&self, join: bool) -> MatrixUri
 Available on crate feature events only.
pub fn matrix_uri(&self, join: bool) -> MatrixUri
events only.Create a matrix: URI for this room ID.
If join is true, a click on the URI should join the room.
Note that it is recommended to provide servers that should know the room to be able to find
it with its room ID. For that use RoomId::matrix_uri_via().
§Example
use ruma_common::{room_id, server_name};
assert_eq!(
    room_id!("!somewhere:example.org").matrix_uri(false).to_string(),
    "matrix:roomid/somewhere:example.org"
);Sourcepub fn matrix_uri_via<T>(&self, via: T, join: bool) -> MatrixUri
 Available on crate feature events only.
pub fn matrix_uri_via<T>(&self, via: T, join: bool) -> MatrixUri
events only.Create a matrix: URI for this room ID with a list of servers that should know it.
To get the list of servers, it is recommended to use the routing algorithm from the spec.
If you don’t have a list of servers, you can use RoomId::matrix_uri() instead.
If join is true, a click on the URI should join the room.
§Example
use ruma_common::{room_id, server_name};
assert_eq!(
    room_id!("!somewhere:example.org")
        .matrix_uri_via(
            [&*server_name!("example.org"), &*server_name!("alt.example.org")],
            true
        )
        .to_string(),
    "matrix:roomid/somewhere:example.org?via=example.org&via=alt.example.org&action=join"
);Sourcepub fn matrix_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixUri
 Available on crate feature events only.
pub fn matrix_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixUri
events only.Create a matrix: URI for an event scoped under this room ID.
Note that it is recommended to provide servers that should know the room to be able to find
it with its room ID. For that use RoomId::matrix_event_uri_via().
Sourcepub fn matrix_event_uri_via<T>(
    &self,
    ev_id: impl Into<OwnedEventId>,
    via: T,
) -> MatrixUri
 Available on crate feature events only.
pub fn matrix_event_uri_via<T>( &self, ev_id: impl Into<OwnedEventId>, via: T, ) -> MatrixUri
events only.Create a matrix: URI for an event scoped under this room ID with a list of servers that
should know it.
To get the list of servers, it is recommended to use the routing algorithm from the spec.
If you don’t have a list of servers, you can use RoomId::matrix_event_uri() instead.
Trait Implementations§
Source§impl AsRef<[u8]> for OwnedRoomId
 
impl AsRef<[u8]> for OwnedRoomId
Source§impl AsRef<RoomId> for OwnedRoomId
 
impl AsRef<RoomId> for OwnedRoomId
Source§impl AsRef<str> for OwnedRoomId
 
impl AsRef<str> for OwnedRoomId
Source§impl Borrow<RoomId> for OwnedRoomId
 
impl Borrow<RoomId> for OwnedRoomId
Source§impl Clone for OwnedRoomId
 
impl Clone for OwnedRoomId
Source§fn clone(&self) -> OwnedRoomId
 
fn clone(&self) -> OwnedRoomId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OwnedRoomId
 
impl Debug for OwnedRoomId
Source§impl Deref for OwnedRoomId
 
impl Deref for OwnedRoomId
Source§impl<'de> Deserialize<'de> for OwnedRoomId
 
impl<'de> Deserialize<'de> for OwnedRoomId
Source§fn deserialize<D>(
    deserializer: D,
) -> Result<OwnedRoomId, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<OwnedRoomId, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Source§impl Display for OwnedRoomId
 
impl Display for OwnedRoomId
Source§impl Extend<OwnedRoomId> for DoNotDisturbEventContent
 
impl Extend<OwnedRoomId> for DoNotDisturbEventContent
Source§fn extend<T>(&mut self, iter: T)where
    T: IntoIterator<Item = OwnedRoomId>,
 
fn extend<T>(&mut self, iter: T)where
    T: IntoIterator<Item = OwnedRoomId>,
Source§fn extend_one(&mut self, item: A)
 
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
 
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<&RoomId> for OwnedRoomId
 
impl From<&RoomId> for OwnedRoomId
Source§fn from(id: &RoomId) -> OwnedRoomId
 
fn from(id: &RoomId) -> OwnedRoomId
Source§impl From<OwnedRoomId> for MatrixId
 
impl From<OwnedRoomId> for MatrixId
Source§fn from(room_id: OwnedRoomId) -> MatrixId
 
fn from(room_id: OwnedRoomId) -> MatrixId
Source§impl From<OwnedRoomId> for OwnedRoomOrAliasId
 
impl From<OwnedRoomId> for OwnedRoomOrAliasId
Source§fn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
 
fn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
Source§impl From<OwnedRoomId> for String
 
impl From<OwnedRoomId> for String
Source§fn from(id: OwnedRoomId) -> String
 
fn from(id: OwnedRoomId) -> String
Source§impl FromIterator<OwnedRoomId> for DoNotDisturbEventContent
 
impl FromIterator<OwnedRoomId> for DoNotDisturbEventContent
Source§fn from_iter<T>(iter: T) -> DoNotDisturbEventContentwhere
    T: IntoIterator<Item = OwnedRoomId>,
 
fn from_iter<T>(iter: T) -> DoNotDisturbEventContentwhere
    T: IntoIterator<Item = OwnedRoomId>,
Source§impl FromStr for OwnedRoomId
 
impl FromStr for OwnedRoomId
Source§impl Hash for OwnedRoomId
 
impl Hash for OwnedRoomId
Source§impl Ord for OwnedRoomId
 
impl Ord for OwnedRoomId
Source§fn cmp(&self, other: &OwnedRoomId) -> Ordering
 
fn cmp(&self, other: &OwnedRoomId) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Source§impl PartialEq<&RoomId> for OwnedRoomId
 
impl PartialEq<&RoomId> for OwnedRoomId
Source§impl PartialEq<&str> for OwnedRoomId
 
impl PartialEq<&str> for OwnedRoomId
Source§impl PartialEq<OwnedRoomId> for &RoomId
 
impl PartialEq<OwnedRoomId> for &RoomId
Source§impl PartialEq<OwnedRoomId> for &str
 
impl PartialEq<OwnedRoomId> for &str
Source§impl PartialEq<OwnedRoomId> for RoomId
 
impl PartialEq<OwnedRoomId> for RoomId
Source§impl PartialEq<OwnedRoomId> for str
 
impl PartialEq<OwnedRoomId> for str
Source§impl PartialEq<RoomId> for OwnedRoomId
 
impl PartialEq<RoomId> for OwnedRoomId
Source§impl PartialEq<String> for OwnedRoomId
 
impl PartialEq<String> for OwnedRoomId
Source§impl PartialEq<str> for OwnedRoomId
 
impl PartialEq<str> for OwnedRoomId
Source§impl PartialEq for OwnedRoomId
 
impl PartialEq for OwnedRoomId
Source§impl PartialOrd for OwnedRoomId
 
impl PartialOrd for OwnedRoomId
Source§impl Serialize for OwnedRoomId
 
impl Serialize for OwnedRoomId
Source§fn 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,
Source§impl TryFrom<&str> for OwnedRoomId
 
impl TryFrom<&str> for OwnedRoomId
Source§impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
 
impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
Source§type Error = OwnedRoomAliasId
 
type Error = OwnedRoomAliasId
Source§fn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
 
fn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
Source§impl TryFrom<String> for OwnedRoomId
 
impl TryFrom<String> for OwnedRoomId
impl Eq for OwnedRoomId
Auto Trait Implementations§
impl Freeze for OwnedRoomId
impl RefUnwindSafe for OwnedRoomId
impl Send for OwnedRoomId
impl Sync for OwnedRoomId
impl Unpin for OwnedRoomId
impl UnwindSafe for OwnedRoomId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<Q, K> Comparable<K> for Q
 
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
 
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.