#[non_exhaustive]pub enum LinkSpec {
OrPort(IpAddr, u16),
RsaId(RsaIdentity),
Ed25519Id(Ed25519Identity),
Unrecognized(LinkSpecType, Vec<u8>),
}
Expand description
A piece of information about a relay and how to connect to it.
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.
OrPort(IpAddr, u16)
The TCP address of an OR Port for a relay
RsaId(RsaIdentity)
The RSA identity fingerprint of the relay
Ed25519Id(Ed25519Identity)
The Ed25519 identity of the relay
Unrecognized(LinkSpecType, Vec<u8>)
A link specifier that we didn’t recognize
Implementations§
Source§impl LinkSpec
impl LinkSpec
Sourcefn sort_pos(&self) -> u8
fn sort_pos(&self) -> u8
Helper: return the position in the list of identifiers in which a given linkspec should occur.
Sourcepub fn sort_by_type(lst: &mut [Self])
pub fn sort_by_type(lst: &mut [Self])
Sort a slice of LinkSpec based on the order in which they should appear in an EXTEND cell.
Sourcefn from_type_and_body(lstype: LinkSpecType, r: &mut Reader<'_>) -> Result<Self>
fn from_type_and_body(lstype: LinkSpecType, r: &mut Reader<'_>) -> Result<Self>
Try to create a LinkSpec of encoded type lstype
, taking its body from a
given reader r
.
Does not check whether r
is exhausted at the end of the operation or not.
Sourcefn lstype(&self) -> LinkSpecType
fn lstype(&self) -> LinkSpecType
Return the command for this linkspec.
Sourcefn encode_body<W: Writer + ?Sized>(&self, w: &mut W) -> EncodeResult<()>
fn encode_body<W: Writer + ?Sized>(&self, w: &mut W) -> EncodeResult<()>
Try to encode the body of this linkspec onto a given writer.
Sourcepub fn encode(&self) -> EncodeResult<EncodedLinkSpec>
pub fn encode(&self) -> EncodeResult<EncodedLinkSpec>
Return an encoded version of this link specifier.
Trait Implementations§
Source§impl From<&SocketAddr> for LinkSpec
impl From<&SocketAddr> for LinkSpec
Source§fn from(sa: &SocketAddr) -> Self
fn from(sa: &SocketAddr) -> Self
Converts to this type from the input type.
Source§impl From<SocketAddr> for LinkSpec
impl From<SocketAddr> for LinkSpec
Source§fn from(sa: SocketAddr) -> Self
fn from(sa: SocketAddr) -> Self
Converts to this type from the input type.
Source§impl HasMemoryCostStructural for LinkSpec
impl HasMemoryCostStructural for LinkSpec
Source§fn indirect_memory_cost(&self, et: EnabledToken) -> usize
fn indirect_memory_cost(&self, et: EnabledToken) -> usize
Memory cost of data stored out-of-line Read more
impl Eq for LinkSpec
impl StructuralPartialEq for LinkSpec
Auto Trait Implementations§
impl Freeze for LinkSpec
impl RefUnwindSafe for LinkSpec
impl Send for LinkSpec
impl Sync for LinkSpec
impl Unpin for LinkSpec
impl UnwindSafe for LinkSpec
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> 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> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
§fn memory_cost(&self, et: EnabledToken) -> usize
fn memory_cost(&self, et: EnabledToken) -> usize
Returns the memory cost of
self
, in bytes Read more§impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
§fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
The cost, as a
TypedMemoryCost<T>
rather than a raw usize
§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