Struct matrix_sdk_base::ruma::OwnedRoomId
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>§
pub fn server_name(&self) -> Option<&ServerName>
pub fn server_name(&self) -> Option<&ServerName>
Returns the server name of the room ID.
pub 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"
);
pub 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"
);
pub 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()
.
pub 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.
pub 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"
);
pub 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"
);
pub 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()
.
pub 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§
§impl AsRef<[u8]> for OwnedRoomId
impl AsRef<[u8]> for OwnedRoomId
§impl AsRef<RoomId> for OwnedRoomId
impl AsRef<RoomId> for OwnedRoomId
§impl AsRef<str> for OwnedRoomId
impl AsRef<str> for OwnedRoomId
§impl Borrow<RoomId> for OwnedRoomId
impl Borrow<RoomId> for OwnedRoomId
§impl Clone for OwnedRoomId
impl Clone for OwnedRoomId
§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 more§impl Debug for OwnedRoomId
impl Debug for OwnedRoomId
§impl Deref for OwnedRoomId
impl Deref for OwnedRoomId
§impl<'de> Deserialize<'de> for OwnedRoomId
impl<'de> Deserialize<'de> for OwnedRoomId
§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>,
§impl Display for OwnedRoomId
impl Display for OwnedRoomId
§impl From<&RoomId> for OwnedRoomId
impl From<&RoomId> for OwnedRoomId
§fn from(id: &RoomId) -> OwnedRoomId
fn from(id: &RoomId) -> OwnedRoomId
§impl From<Arc<RoomId>> for OwnedRoomId
impl From<Arc<RoomId>> for OwnedRoomId
§fn from(a: Arc<RoomId>) -> OwnedRoomId
fn from(a: Arc<RoomId>) -> OwnedRoomId
§impl From<Box<RoomId>> for OwnedRoomId
impl From<Box<RoomId>> for OwnedRoomId
§fn from(b: Box<RoomId>) -> OwnedRoomId
fn from(b: Box<RoomId>) -> OwnedRoomId
§impl From<OwnedRoomId> for Arc<RoomId>
impl From<OwnedRoomId> for Arc<RoomId>
§fn from(a: OwnedRoomId) -> Arc<RoomId>
fn from(a: OwnedRoomId) -> Arc<RoomId>
§impl From<OwnedRoomId> for Box<RoomId>
impl From<OwnedRoomId> for Box<RoomId>
§fn from(a: OwnedRoomId) -> Box<RoomId>
fn from(a: OwnedRoomId) -> Box<RoomId>
§impl From<OwnedRoomId> for MatrixId
impl From<OwnedRoomId> for MatrixId
§fn from(room_id: OwnedRoomId) -> MatrixId
fn from(room_id: OwnedRoomId) -> MatrixId
§impl From<OwnedRoomId> for OwnedRoomOrAliasId
impl From<OwnedRoomId> for OwnedRoomOrAliasId
§fn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
fn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
§impl From<OwnedRoomId> for String
impl From<OwnedRoomId> for String
§fn from(id: OwnedRoomId) -> String
fn from(id: OwnedRoomId) -> String
§impl FromStr for OwnedRoomId
impl FromStr for OwnedRoomId
§impl Hash for OwnedRoomId
impl Hash for OwnedRoomId
§impl Ord for OwnedRoomId
impl Ord for OwnedRoomId
§impl PartialEq<&RoomId> for OwnedRoomId
impl PartialEq<&RoomId> for OwnedRoomId
§impl PartialEq<&str> for OwnedRoomId
impl PartialEq<&str> for OwnedRoomId
§impl PartialEq<Arc<RoomId>> for OwnedRoomId
impl PartialEq<Arc<RoomId>> for OwnedRoomId
§impl PartialEq<Box<RoomId>> for OwnedRoomId
impl PartialEq<Box<RoomId>> for OwnedRoomId
§impl PartialEq<OwnedRoomId> for &RoomId
impl PartialEq<OwnedRoomId> for &RoomId
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialEq<OwnedRoomId> for &str
impl PartialEq<OwnedRoomId> for &str
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialEq<OwnedRoomId> for RoomId
impl PartialEq<OwnedRoomId> for RoomId
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialEq<OwnedRoomId> for String
impl PartialEq<OwnedRoomId> for String
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialEq<OwnedRoomId> for str
impl PartialEq<OwnedRoomId> for str
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialEq<RoomId> for OwnedRoomId
impl PartialEq<RoomId> for OwnedRoomId
§impl PartialEq<String> for OwnedRoomId
impl PartialEq<String> for OwnedRoomId
§impl PartialEq<str> for OwnedRoomId
impl PartialEq<str> for OwnedRoomId
§impl PartialEq for OwnedRoomId
impl PartialEq for OwnedRoomId
§fn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for OwnedRoomId
impl PartialOrd for OwnedRoomId
§fn partial_cmp(&self, other: &OwnedRoomId) -> Option<Ordering>
fn partial_cmp(&self, other: &OwnedRoomId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more§impl Serialize for OwnedRoomId
impl Serialize for OwnedRoomId
§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,
§impl TryFrom<&str> for OwnedRoomId
impl TryFrom<&str> for OwnedRoomId
§impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
§type Error = OwnedRoomAliasId
type Error = OwnedRoomAliasId
§fn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
fn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
§impl TryFrom<String> for OwnedRoomId
impl TryFrom<String> for OwnedRoomId
impl Eq for OwnedRoomId
Auto Trait Implementations§
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.