[][src]Struct libp2p::PeerId

pub struct PeerId { /* fields omitted */ }

Identifier of a peer of the network.

The data is a multihash of the public key of the peer.

Methods

impl PeerId
[src]

Builds a PeerId from a public key.

Checks whether data is a valid PeerId. If so, returns the PeerId. If not, returns back the data as an error.

Turns a Multihash into a PeerId. If the multihash doesn't use the correct algorithm, returns back the data as an error.

Generates a random peer ID from a cryptographically secure PRNG.

This is useful for randomly walking on a DHT, or for testing purposes.

Returns a raw bytes representation of this PeerId.

Note that this is not the same as the public key of the peer.

Returns a raw bytes representation of this PeerId.

Note that this is not the same as the public key of the peer.

Returns a base-58 encoded string of this PeerId.

Returns the raw bytes of the hash of this PeerId.

Checks whether the public key passed as parameter matches the public key of this PeerId.

Returns None if this PeerIds hash algorithm is not supported when encoding the given public key, otherwise Some boolean as the result of an equality check.

Trait Implementations

impl PartialEq<PeerId> for PeerId
[src]

impl PartialEq<Multihash> for PeerId
[src]

This method tests for !=.

impl Eq for PeerId
[src]

impl Debug for PeerId
[src]

impl Hash for PeerId
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Into<Multihash> for PeerId
[src]

impl Clone for PeerId
[src]

Performs copy-assignment from source. Read more

impl FromStr for PeerId
[src]

The associated error which can be returned from parsing.

impl AsRef<Multihash> for PeerId
[src]

impl From<PublicKey> for PeerId
[src]

Auto Trait Implementations

impl Send for PeerId

impl Sync for PeerId

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

Should always be Self

impl<T> Erased for T

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.