Struct ruma::OwnedRoomId
source · [−]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) -> &ServerName
pub fn server_name(&self) -> &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/#/%21somewhere%3Aexample.org"
);
sourcepub fn matrix_to_uri_via<T>(&self, via: T) -> MatrixToUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
pub fn matrix_to_uri_via<T>(&self, via: T) -> MatrixToUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
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/#/%21somewhere%3Aexample.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
) -> MatrixToUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
pub fn matrix_to_event_uri_via<T>(
&self,
ev_id: impl Into<OwnedEventId>,
via: T
) -> MatrixToUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
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) -> MatrixUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
pub fn matrix_uri_via<T>(&self, via: T, join: bool) -> MatrixUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
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
) -> MatrixUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
pub fn matrix_event_uri_via<T>(
&self,
ev_id: impl Into<OwnedEventId>,
via: T
) -> MatrixUriwhere
T: IntoIterator,
<T as IntoIterator>::Item: Into<OwnedServerName>,
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
sourceimpl AsRef<RoomId> for OwnedRoomId
impl AsRef<RoomId> for OwnedRoomId
sourceimpl AsRef<str> for OwnedRoomId
impl AsRef<str> for OwnedRoomId
sourceimpl Borrow<RoomId> for OwnedRoomId
impl Borrow<RoomId> for OwnedRoomId
sourceimpl Clone for OwnedRoomId
impl Clone for OwnedRoomId
sourcefn clone(&self) -> OwnedRoomId
fn clone(&self) -> OwnedRoomId
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for OwnedRoomId
impl Debug for OwnedRoomId
sourceimpl Deref for OwnedRoomId
impl Deref for OwnedRoomId
sourceimpl<'de> Deserialize<'de> for OwnedRoomId
impl<'de> Deserialize<'de> for OwnedRoomId
sourcefn 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>,
sourceimpl Display for OwnedRoomId
impl Display for OwnedRoomId
sourceimpl From<&RoomId> for OwnedRoomId
impl From<&RoomId> for OwnedRoomId
sourcefn from(id: &RoomId) -> OwnedRoomId
fn from(id: &RoomId) -> OwnedRoomId
sourceimpl From<Arc<RoomId>> for OwnedRoomId
impl From<Arc<RoomId>> for OwnedRoomId
sourcefn from(a: Arc<RoomId>) -> OwnedRoomId
fn from(a: Arc<RoomId>) -> OwnedRoomId
sourceimpl From<OwnedRoomId> for Arc<RoomId>
impl From<OwnedRoomId> for Arc<RoomId>
sourcefn from(a: OwnedRoomId) -> Arc<RoomId>
fn from(a: OwnedRoomId) -> Arc<RoomId>
sourceimpl From<OwnedRoomId> for MatrixId
impl From<OwnedRoomId> for MatrixId
sourcefn from(room_id: OwnedRoomId) -> MatrixId
fn from(room_id: OwnedRoomId) -> MatrixId
sourceimpl From<OwnedRoomId> for OwnedRoomOrAliasId
impl From<OwnedRoomId> for OwnedRoomOrAliasId
sourcefn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
fn from(room_id: OwnedRoomId) -> OwnedRoomOrAliasId
sourceimpl FromStr for OwnedRoomId
impl FromStr for OwnedRoomId
sourceimpl Hash for OwnedRoomId
impl Hash for OwnedRoomId
sourceimpl Ord for OwnedRoomId
impl Ord for OwnedRoomId
sourcefn cmp(&self, other: &OwnedRoomId) -> Ordering
fn cmp(&self, other: &OwnedRoomId) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialEq<Box<RoomId, Global>> for OwnedRoomId
impl PartialEq<Box<RoomId, Global>> for OwnedRoomId
sourceimpl PartialEq<OwnedRoomId> for &RoomId
impl PartialEq<OwnedRoomId> for &RoomId
sourcefn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
sourceimpl PartialEq<OwnedRoomId> for &str
impl PartialEq<OwnedRoomId> for &str
sourcefn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
sourceimpl PartialEq<OwnedRoomId> for OwnedRoomId
impl PartialEq<OwnedRoomId> for OwnedRoomId
sourcefn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
sourceimpl PartialEq<OwnedRoomId> for RoomId
impl PartialEq<OwnedRoomId> for RoomId
sourcefn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
sourceimpl PartialEq<OwnedRoomId> for str
impl PartialEq<OwnedRoomId> for str
sourcefn eq(&self, other: &OwnedRoomId) -> bool
fn eq(&self, other: &OwnedRoomId) -> bool
sourceimpl PartialOrd<OwnedRoomId> for OwnedRoomId
impl PartialOrd<OwnedRoomId> for OwnedRoomId
sourcefn partial_cmp(&self, other: &OwnedRoomId) -> Option<Ordering>
fn partial_cmp(&self, other: &OwnedRoomId) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl Serialize for OwnedRoomId
impl Serialize for OwnedRoomId
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,
sourceimpl TryFrom<&str> for OwnedRoomId
impl TryFrom<&str> for OwnedRoomId
sourceimpl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
impl TryFrom<OwnedRoomOrAliasId> for OwnedRoomId
type Error = OwnedRoomAliasId
type Error = OwnedRoomAliasId
sourcefn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
fn try_from(id: OwnedRoomOrAliasId) -> Result<OwnedRoomId, OwnedRoomAliasId>
sourceimpl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.