pub type DeviceKeyId = KeyId<DeviceKeyAlgorithm, DeviceId>;
Expand description
Algorithm + key name for device keys.
Aliased Type§
struct DeviceKeyId(/* private fields */);
Implementations
Source§impl<A, K> KeyId<A, K>
impl<A, K> KeyId<A, K>
Sourcepub fn parse(s: impl AsRef<str>) -> Result<OwnedKeyId<A, K>, Error>
Available on crate feature events
only.
pub fn parse(s: impl AsRef<str>) -> Result<OwnedKeyId<A, K>, Error>
events
only.Try parsing a &str
into an OwnedKeyId
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
Sourcepub fn parse_box(
s: impl AsRef<str> + Into<Box<str>>,
) -> Result<Box<KeyId<A, K>>, Error>
Available on crate feature events
only.
pub fn parse_box( s: impl AsRef<str> + Into<Box<str>>, ) -> Result<Box<KeyId<A, K>>, Error>
events
only.Try parsing a &str
into a Box<KeyId>
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
Source§impl<A, K> KeyId<A, K>
impl<A, K> KeyId<A, K>
Sourcepub fn from_parts(algorithm: A, key_name: &K) -> OwnedKeyId<A, K>
Available on crate feature events
only.
pub fn from_parts(algorithm: A, key_name: &K) -> OwnedKeyId<A, K>
events
only.Creates a new KeyId
from an algorithm and key name.
Sourcepub fn algorithm(&self) -> A
Available on crate feature events
only.
pub fn algorithm(&self) -> A
events
only.Returns key algorithm of the key ID - the part that comes before the colon.
§Example
use ruma_common::{DeviceKeyAlgorithm, DeviceKeyId};
let k = DeviceKeyId::parse("ed25519:1").unwrap();
assert_eq!(k.algorithm(), DeviceKeyAlgorithm::Ed25519);
Sourcepub fn key_name<'a>(&'a self) -> &'a K
Available on crate feature events
only.
pub fn key_name<'a>(&'a self) -> &'a K
events
only.Returns the key name of the key ID - the part that comes after the colon.
§Example
use ruma_common::{device_id, DeviceKeyId};
let k = DeviceKeyId::parse("ed25519:DEV1").unwrap();
assert_eq!(k.key_name(), device_id!("DEV1"));
Trait Implementations
Source§impl<A, K> PartialEq<OwnedKeyId<A, K>> for KeyId<A, K>
impl<A, K> PartialEq<OwnedKeyId<A, K>> for KeyId<A, K>
Source§impl<A, K> PartialOrd for KeyId<A, K>
impl<A, K> PartialOrd for KeyId<A, K>
Source§impl<A, K> Serialize for KeyId<A, K>
impl<A, K> Serialize for KeyId<A, K>
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<A, K> ToOwned for KeyId<A, K>
impl<A, K> ToOwned for KeyId<A, K>
Source§type Owned = OwnedKeyId<A, K>
type Owned = OwnedKeyId<A, K>
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> <KeyId<A, K> as ToOwned>::Owned
fn to_owned(&self) -> <KeyId<A, K> 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