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 useArc
as a wrapper type.
Methods from Deref<Target = RoomId>§
Sourcepub fn server_name(&self) -> Option<&ServerName>
pub fn server_name(&self) -> Option<&ServerName>
Returns the server name of the room ID.
Sourcepub fn matrix_to_uri(&self) -> MatrixToUri
pub fn matrix_to_uri(&self) -> MatrixToUri
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
pub fn matrix_to_uri_via<T>(&self, via: T) -> MatrixToUri
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
pub fn matrix_to_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixToUri
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
pub fn matrix_to_event_uri_via<T>( &self, ev_id: impl Into<OwnedEventId>, via: T, ) -> MatrixToUri
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
pub fn matrix_uri(&self, join: bool) -> MatrixUri
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
pub fn matrix_uri_via<T>(&self, via: T, join: bool) -> MatrixUri
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
pub fn matrix_event_uri(&self, ev_id: impl Into<OwnedEventId>) -> MatrixUri
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
pub fn matrix_event_uri_via<T>( &self, ev_id: impl Into<OwnedEventId>, via: T, ) -> MatrixUri
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§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<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for OwnedRoomId
impl Display for OwnedRoomId
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) -> Self
fn from(room_id: OwnedRoomId) -> Self
Source§impl From<OwnedRoomId> for OwnedRoomOrAliasId
impl From<OwnedRoomId> for OwnedRoomOrAliasId
Source§fn from(room_id: OwnedRoomId) -> Self
fn from(room_id: OwnedRoomId) -> Self
Source§impl From<OwnedRoomId> for String
impl From<OwnedRoomId> for String
Source§fn from(id: OwnedRoomId) -> String
fn from(id: OwnedRoomId) -> String
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§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 String
impl PartialEq<OwnedRoomId> for String
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§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.