Struct libp2p::core::PeerId [−][src]
pub struct PeerId { /* fields omitted */ }
Expand description
Identifier of a peer of the network.
The data is a multihash of the public key of the peer.
Implementations
Builds a PeerId
from a public key.
Tries to turn a Multihash
into a PeerId
.
If the multihash does not use a valid hashing algorithm for peer IDs,
or the hash value does not satisfy the constraints for a hashed
peer ID, it is returned as an Err
.
Generates a peerId with a public key in it
Generates a random peer ID from a cryptographically secure PRNG.
This is useful for randomly walking on a DHT, or for testing purposes.
Checks whether the public key passed as parameter matches the public key of this PeerId
.
Returns None
if this PeerId
s hash algorithm is not supported when encoding the
given public key, otherwise Some
boolean as the result of an equality check.
Returns public key if it was inlined in this PeerId
.
Returns true if this peer id is inlining (usually means it stores public key)
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
The type returned in the event of a conversion error.
Auto Trait Implementations
impl RefUnwindSafe for PeerId
impl UnwindSafe for PeerId
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> CallHasher for T where
T: Hash,
impl<T> CallHasher for T where
T: Hash,
pub fn vzip(self) -> V