Struct 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
§impl PartialEq<OwnedRoomId> for &str
impl PartialEq<OwnedRoomId> for &str
§impl PartialEq<OwnedRoomId> for Box<RoomId>
impl PartialEq<OwnedRoomId> for Box<RoomId>
§impl PartialEq<OwnedRoomId> for RoomId
impl PartialEq<OwnedRoomId> for RoomId
§impl PartialEq<OwnedRoomId> for String
impl PartialEq<OwnedRoomId> for String
§impl PartialEq<OwnedRoomId> for str
impl PartialEq<OwnedRoomId> for str
§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
§impl PartialOrd for OwnedRoomId
impl PartialOrd for OwnedRoomId
§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 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
§impl<T> CompatExt for T
impl<T> CompatExt for T
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.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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<I> IntoResettable<String> for I
impl<I> IntoResettable<String> for I
Source§fn into_resettable(self) -> Resettable<String>
fn into_resettable(self) -> Resettable<String>
Source§impl<Ctx, T> MeasureWith<Ctx> for T
impl<Ctx, T> MeasureWith<Ctx> for T
Source§fn measure_with(&self, _ctx: &Ctx) -> usize
fn measure_with(&self, _ctx: &Ctx) -> usize
Self
, given the ctx
?