Struct ruma_common::KeyId

source ·
pub struct KeyId<A, K: ?Sized>(/* private fields */);
Expand description

A key algorithm and key name delimited by a colon.

Implementations§

source§

impl<A, K: ?Sized> KeyId<A, K>

source

pub fn as_str(&self) -> &str

Creates a string slice from this KeyId.

source

pub fn as_bytes(&self) -> &[u8]

Creates a byte slice from this KeyId.

source§

impl<A, K: ?Sized> KeyId<A, K>

source

pub fn parse(s: impl AsRef<str>) -> Result<OwnedKeyId<A, K>, IdParseError>

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.

source

pub fn parse_box( s: impl AsRef<str> + Into<Box<str>> ) -> Result<Box<Self>, IdParseError>

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

pub fn parse_rc( s: impl AsRef<str> + Into<Rc<str>> ) -> Result<Rc<Self>, IdParseError>

Try parsing a &str into an Rc<KeyId>.

source

pub fn parse_arc( s: impl AsRef<str> + Into<Arc<str>> ) -> Result<Arc<Self>, IdParseError>

Try parsing a &str into an Arc<KeyId>.

source§

impl<A, K: ?Sized> KeyId<A, K>

source

pub fn from_parts(algorithm: A, key_name: &K) -> OwnedKeyId<A, K>where A: AsRef<str>, K: AsRef<str>,

Creates a new KeyId from an algorithm and key name.

source

pub fn algorithm(&self) -> Awhere A: FromStr,

Returns key algorithm of the key ID.

source

pub fn key_name<'a>(&'a self) -> &'a Kwhere &'a K: From<&'a str>,

Returns the key name of the key ID.

Trait Implementations§

source§

impl<A, K: ?Sized> AsRef<[u8]> for Box<KeyId<A, K>>

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> AsRef<[u8]> for KeyId<A, K>

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> AsRef<KeyId<A, K>> for KeyId<A, K>

source§

fn as_ref(&self) -> &KeyId<A, K>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> AsRef<KeyId<A, K>> for OwnedKeyId<A, K>

source§

fn as_ref(&self) -> &KeyId<A, K>

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> AsRef<str> for Box<KeyId<A, K>>

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> AsRef<str> for KeyId<A, K>

source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<A, K: ?Sized> Borrow<KeyId<A, K>> for OwnedKeyId<A, K>

source§

fn borrow(&self) -> &KeyId<A, K>

Immutably borrows from an owned value. Read more
source§

impl<A, K: ?Sized> Clone for Box<KeyId<A, K>>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A, K: ?Sized> Debug for KeyId<A, K>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de, A, K: ?Sized> Deserialize<'de> for Box<KeyId<A, K>>

source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<A, K: ?Sized> Display for KeyId<A, K>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<A, K: ?Sized> From<&KeyId<A, K>> for Arc<KeyId<A, K>>

source§

fn from(s: &KeyId<A, K>) -> Arc<KeyId<A, K>>

Converts to this type from the input type.
source§

impl<A, K: ?Sized> From<&KeyId<A, K>> for Box<KeyId<A, K>>

source§

fn from(id: &KeyId<A, K>) -> Self

Converts to this type from the input type.
source§

impl<A, K: ?Sized> From<&KeyId<A, K>> for OwnedKeyId<A, K>

source§

fn from(id: &KeyId<A, K>) -> OwnedKeyId<A, K>

Converts to this type from the input type.
source§

impl<A, K: ?Sized> From<&KeyId<A, K>> for Rc<KeyId<A, K>>

source§

fn from(s: &KeyId<A, K>) -> Rc<KeyId<A, K>>

Converts to this type from the input type.
source§

impl<A, K: ?Sized> From<&KeyId<A, K>> for String

source§

fn from(id: &KeyId<A, K>) -> Self

Converts to this type from the input type.
source§

impl<A, K: ?Sized> From<OwnedKeyId<A, K>> for Box<KeyId<A, K>>

source§

fn from(a: OwnedKeyId<A, K>) -> Box<KeyId<A, K>>

Converts to this type from the input type.
source§

impl<A, K: ?Sized> FromStr for Box<KeyId<A, K>>

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<A, K: ?Sized> Hash for KeyId<A, K>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
source§

impl<A, K: ?Sized> Ord for KeyId<A, K>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl<A, K: ?Sized> PartialEq<&KeyId<A, K>> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &&KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<&KeyId<A, K>> for OwnedKeyId<A, K>

source§

fn eq(&self, other: &&KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<&str> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &&str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<&str> for KeyId<A, K>

source§

fn eq(&self, other: &&str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<Box<KeyId<A, K>>> for &KeyId<A, K>

source§

fn eq(&self, other: &Box<KeyId<A, K>>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<Box<KeyId<A, K>>> for KeyId<A, K>

source§

fn eq(&self, other: &Box<KeyId<A, K>>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<KeyId<A, K>> for &str

source§

fn eq(&self, other: &KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<KeyId<A, K>> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<KeyId<A, K>> for OwnedKeyId<A, K>

source§

fn eq(&self, other: &KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<KeyId<A, K>> for String

source§

fn eq(&self, other: &KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<KeyId<A, K>> for str

source§

fn eq(&self, other: &KeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<OwnedKeyId<A, K>> for &KeyId<A, K>

source§

fn eq(&self, other: &OwnedKeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<OwnedKeyId<A, K>> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &OwnedKeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<OwnedKeyId<A, K>> for KeyId<A, K>

source§

fn eq(&self, other: &OwnedKeyId<A, K>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<String> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<String> for KeyId<A, K>

source§

fn eq(&self, other: &String) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<str> for Box<KeyId<A, K>>

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq<str> for KeyId<A, K>

source§

fn eq(&self, other: &str) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialEq for KeyId<A, K>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<A, K: ?Sized> PartialOrd for KeyId<A, K>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<A, K: ?Sized> Serialize for KeyId<A, K>

source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<A, K: ?Sized> ToOwned for KeyId<A, K>

§

type Owned = OwnedKeyId<A, K>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<'a, A, K: ?Sized> TryFrom<&'a str> for &'a KeyId<A, K>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(s: &'a str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<A, K: ?Sized> TryFrom<&str> for Box<KeyId<A, K>>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(s: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<A, K: ?Sized> TryFrom<String> for Box<KeyId<A, K>>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(s: String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<A, K: ?Sized> Eq for KeyId<A, K>

Auto Trait Implementations§

§

impl<A, K: ?Sized> RefUnwindSafe for KeyId<A, K>where A: RefUnwindSafe, K: RefUnwindSafe,

§

impl<A, K: ?Sized> Send for KeyId<A, K>where A: Send, K: Send,

§

impl<A, K> !Sized for KeyId<A, K>

§

impl<A, K: ?Sized> Sync for KeyId<A, K>where A: Sync, K: Sync,

§

impl<A, K: ?Sized> Unpin for KeyId<A, K>where A: Unpin, K: Unpin,

§

impl<A, K: ?Sized> UnwindSafe for KeyId<A, K>where A: UnwindSafe, K: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, W> HasTypeWitness<W> for Twhere W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for Twhere T: ?Sized,

§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more