pub struct PeerId { /* fields omitted */ }
Identifier of a peer of the network.
The data is a multihash of the public key of the peer.
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 PeerId
s hash algorithm is not supported when encoding the
given public key, otherwise Some
boolean as the result of an equality check.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
type Err = ParseError
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static