Enum tor_linkspec::RelayId
source · #[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(original: Ed25519Identity) -> RelayId
fn from(original: Ed25519Identity) -> RelayId
Converts to this type from the input type.
source§impl From<RsaIdentity> for RelayId
impl From<RsaIdentity> for RelayId
source§fn from(original: RsaIdentity) -> RelayId
fn from(original: RsaIdentity) -> RelayId
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.
§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§fn eq(&self, other: &Ed25519Identity) -> bool
fn eq(&self, other: &Ed25519Identity) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialEq<RelayId> for RelayId
impl PartialEq<RelayId> for RelayId
source§impl PartialEq<RsaIdentity> for RelayId
impl PartialEq<RsaIdentity> for RelayId
source§fn eq(&self, other: &RsaIdentity) -> bool
fn eq(&self, other: &RsaIdentity) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd<RelayId> for RelayId
impl PartialOrd<RelayId> for RelayId
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 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 StructuralEq for RelayId
impl StructuralPartialEq for RelayId
Auto Trait Implementations§
impl RefUnwindSafe for RelayId
impl Send for RelayId
impl Sync for RelayId
impl Unpin for RelayId
impl UnwindSafe for RelayId
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
Mutably borrows from an owned value. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§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 Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.