#[non_exhaustive]pub enum RelayId {
Ed25519(Ed25519Identity),
Rsa(RsaIdentity),
}
Expand description
A single relay identity.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl RelayId
impl RelayId
Sourcepub fn as_ref(&self) -> RelayIdRef<'_>
pub fn as_ref(&self) -> RelayIdRef<'_>
Return a RelayIdRef
pointing to the contents of this identity.
Sourcepub fn from_type_and_bytes(
id_type: RelayIdType,
id: &[u8],
) -> Result<Self, RelayIdError>
pub fn from_type_and_bytes( id_type: RelayIdType, id: &[u8], ) -> Result<Self, RelayIdError>
Try to construct a RelayId of a provided id_type
from a byte-slice.
Return RelayIdError::BadLength
if the slice is not the correct length for the key.
Sourcepub fn id_type(&self) -> RelayIdType
pub fn id_type(&self) -> RelayIdType
Return the type of this relay identity.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RelayId
impl<'de> Deserialize<'de> for RelayId
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
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> From<&'a RelayId> for RelayIdRef<'a>
impl<'a> From<&'a RelayId> for RelayIdRef<'a>
Source§impl From<Ed25519Identity> for RelayId
impl From<Ed25519Identity> for RelayId
Source§fn from(value: Ed25519Identity) -> Self
fn from(value: Ed25519Identity) -> Self
Converts to this type from the input type.
Source§impl From<RsaIdentity> for RelayId
impl From<RsaIdentity> for RelayId
Source§fn from(value: RsaIdentity) -> Self
fn from(value: RsaIdentity) -> Self
Converts to this type from the input type.
Source§impl FromIterator<RelayId> for RelayIdSet
impl FromIterator<RelayId> for RelayIdSet
Source§impl FromStr for RelayId
impl FromStr for RelayId
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Try to parse s
as a RelayId.
We use the following format, based on the one used by C tor.
- An optional
$
followed by a 40 byte hex string is always an RSA key. - A 43 character un-padded base-64 string is always an Ed25519 key.
- The name of an algorithm (“rsa” or “ed25519”), followed by a colon and and an un-padded base-64 string is a key of that type.
Source§type Err = RelayIdError
type Err = RelayIdError
The associated error which can be returned from parsing.
Source§impl Ord for RelayId
impl Ord for RelayId
Source§impl PartialEq<Ed25519Identity> for RelayId
impl PartialEq<Ed25519Identity> for RelayId
Source§impl PartialEq<RsaIdentity> for RelayId
impl PartialEq<RsaIdentity> for RelayId
Source§impl PartialOrd for RelayId
impl PartialOrd for RelayId
Source§impl Redactable for RelayId
impl Redactable for RelayId
Source§fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
As
Display::fmt
, but produce a redacted representation.Source§fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
As
Debug::fmt
, but produce a redacted representation.Source§fn redacted(&self) -> Redacted<&Self>
fn redacted(&self) -> Redacted<&Self>
Return a smart pointer that will display or debug this object as its
redacted form.
Source§fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
Return a smart pointer that redacts this object if
redact
is true.impl Copy for RelayId
impl Eq for RelayId
impl StructuralPartialEq for RelayId
Auto Trait Implementations§
impl Freeze for RelayId
impl RefUnwindSafe for RelayId
impl Send for RelayId
impl Sync for RelayId
impl Unpin for RelayId
impl UnwindSafe for RelayId
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§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>
Converts
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>
Converts
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 more