pub trait HasRelayIds {
// Required method
fn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>;
// Provided methods
fn identities(&self) -> RelayIdIter<'_, Self> { ... }
fn ed_identity(&self) -> Option<&Ed25519Identity> { ... }
fn rsa_identity(&self) -> Option<&RsaIdentity> { ... }
fn has_identity(&self, id: RelayIdRef<'_>) -> bool { ... }
fn has_any_identity(&self) -> bool { ... }
fn same_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool { ... }
fn has_all_relay_ids_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool { ... }
fn has_any_relay_id_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool { ... }
fn cmp_by_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> Ordering { ... }
fn display_relay_ids(&self) -> DisplayRelayIds<'_, Self> { ... }
}
Expand description
An object containing information about a relay’s identity keys.
This trait has a fairly large number of methods, most of which you’re not
actually expected to implement. The only one that you need to provide is
identity
.
Required Methods§
Sourcefn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>
fn identity(&self, key_type: RelayIdType) -> Option<RelayIdRef<'_>>
Return the identity of this relay whose type is key_type
, or None if
the relay has no such identity.
(Currently all relays have all recognized identity types, but we might implement or deprecate an identity type in the future.)
Provided Methods§
Sourcefn identities(&self) -> RelayIdIter<'_, Self>
fn identities(&self) -> RelayIdIter<'_, Self>
Return an iterator over all of the identities held by this object.
Sourcefn ed_identity(&self) -> Option<&Ed25519Identity>
fn ed_identity(&self) -> Option<&Ed25519Identity>
Return the ed25519 identity for this relay if it has one.
Sourcefn rsa_identity(&self) -> Option<&RsaIdentity>
fn rsa_identity(&self) -> Option<&RsaIdentity>
Return the RSA identity for this relay if it has one.
Sourcefn has_identity(&self, id: RelayIdRef<'_>) -> bool
fn has_identity(&self, id: RelayIdRef<'_>) -> bool
Check whether the provided Id is a known identity of this relay.
Remember that a given set of identity keys may be incomplete: some objects that represent a relay have only a subset of the relay’s identities. Therefore, a “true” answer means that the relay has this identity, but a “false” answer could mean that the relay has a different identity of this type, or that it has no known identity of this type.
Sourcefn has_any_identity(&self) -> bool
fn has_any_identity(&self) -> bool
Return true if this object has any known identity.
Sourcefn same_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
fn same_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
Return true if this object has exactly the same relay IDs as other
.
Sourcefn has_all_relay_ids_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
fn has_all_relay_ids_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
Return true if this object has every relay ID that other
does.
(It still returns true if there are some IDs in this object that are not
present in other
.)
Sourcefn has_any_relay_id_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
fn has_any_relay_id_from<T: HasRelayIds + ?Sized>(&self, other: &T) -> bool
Return true if this object has any relay ID that other
has.
This is symmetrical: it returns true if the two objects have any overlap in their identities.
Sourcefn cmp_by_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> Ordering
fn cmp_by_relay_ids<T: HasRelayIds + ?Sized>(&self, other: &T) -> Ordering
Compare this object to another HasRelayIds.
Objects are sorted by Ed25519 identities, with ties decided by RSA identities. An absent identity of a given type is sorted before a present identity of that type.
If additional identities are added in the future, they may taken into consideration before or after the current identity types.
Sourcefn display_relay_ids(&self) -> DisplayRelayIds<'_, Self>
fn display_relay_ids(&self) -> DisplayRelayIds<'_, Self>
Return a reference to this object suitable for formatting its
HasRelayIds
members.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl HasRelayIds for OwnedChanTarget
impl HasRelayIds for OwnedCircTarget
impl HasRelayIds for RelayIds
impl<T: HasRelayIds> HasRelayIds for VerbatimLinkSpecCircTarget<T>
verbatim
only.