pub struct DeviceId(_);
Expand description
A Matrix key ID.
Device identifiers in Matrix are completely opaque character sequences. This type is provided simply for its semantic value.
Example
use ruma_common::{device_id, DeviceId, OwnedDeviceId};
let random_id = DeviceId::new();
assert_eq!(random_id.as_str().len(), 8);
let static_id = device_id!("01234567");
assert_eq!(static_id.as_str(), "01234567");
let ref_id: &DeviceId = "abcdefghi".into();
assert_eq!(ref_id.as_str(), "abcdefghi");
let owned_id: OwnedDeviceId = "ijklmnop".into();
assert_eq!(owned_id.as_str(), "ijklmnop");
Implementations§
Trait Implementations§
source§impl AsRef<DeviceId> for OwnedDeviceId
impl AsRef<DeviceId> for OwnedDeviceId
source§impl Borrow<DeviceId> for OwnedDeviceId
impl Borrow<DeviceId> for OwnedDeviceId
source§impl<'de> Deserialize<'de> for Box<DeviceId, Global>
impl<'de> Deserialize<'de> for Box<DeviceId, Global>
source§fn deserialize<D>(
deserializer: D
) -> Result<Box<DeviceId, Global>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Box<DeviceId, Global>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<&DeviceId> for OwnedDeviceId
impl From<&DeviceId> for OwnedDeviceId
source§fn from(id: &DeviceId) -> OwnedDeviceId
fn from(id: &DeviceId) -> OwnedDeviceId
Converts to this type from the input type.
source§impl PartialEq<&DeviceId> for OwnedDeviceId
impl PartialEq<&DeviceId> for OwnedDeviceId
source§impl PartialEq<&str> for DeviceId
impl PartialEq<&str> for DeviceId
source§impl PartialEq<Box<DeviceId, Global>> for &DeviceId
impl PartialEq<Box<DeviceId, Global>> for &DeviceId
source§impl PartialEq<Box<DeviceId, Global>> for DeviceId
impl PartialEq<Box<DeviceId, Global>> for DeviceId
source§impl PartialEq<DeviceId> for &str
impl PartialEq<DeviceId> for &str
source§impl PartialEq<DeviceId> for DeviceId
impl PartialEq<DeviceId> for DeviceId
source§impl PartialEq<DeviceId> for OwnedDeviceId
impl PartialEq<DeviceId> for OwnedDeviceId
source§impl PartialEq<DeviceId> for str
impl PartialEq<DeviceId> for str
source§impl PartialEq<OwnedDeviceId> for &DeviceId
impl PartialEq<OwnedDeviceId> for &DeviceId
source§fn eq(&self, other: &OwnedDeviceId) -> bool
fn eq(&self, other: &OwnedDeviceId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<OwnedDeviceId> for DeviceId
impl PartialEq<OwnedDeviceId> for DeviceId
source§fn eq(&self, other: &OwnedDeviceId) -> bool
fn eq(&self, other: &OwnedDeviceId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<String> for DeviceId
impl PartialEq<String> for DeviceId
source§impl PartialOrd<DeviceId> for DeviceId
impl PartialOrd<DeviceId> for DeviceId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for DeviceId
impl Serialize for DeviceId
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,
Serialize this value into the given Serde serializer. Read more
source§impl ToOwned for DeviceId
impl ToOwned for DeviceId
§type Owned = OwnedDeviceId
type Owned = OwnedDeviceId
The resulting type after obtaining ownership.
source§fn to_owned(&self) -> <DeviceId as ToOwned>::Owned
fn to_owned(&self) -> <DeviceId as ToOwned>::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more