Struct sc_network_types::PeerId
source · pub struct PeerId { /* private fields */ }
Expand description
Identifier of a peer of the network.
The data is a CIDv0 compatible multihash of the protobuf encoded public key of the peer as specified in specs/peer-ids.
Implementations§
source§impl PeerId
impl PeerId
sourcepub fn try_from_multiaddr(address: &Multiaddr) -> Option<PeerId>
pub fn try_from_multiaddr(address: &Multiaddr) -> Option<PeerId>
Try to extract PeerId
from Multiaddr
.
sourcepub fn from_multihash(multihash: Multihash) -> Result<PeerId, Multihash>
pub fn from_multihash(multihash: Multihash) -> Result<PeerId, Multihash>
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
.
sourcepub fn into_ed25519(&self) -> Option<[u8; 32]>
pub fn into_ed25519(&self) -> Option<[u8; 32]>
Convert PeerId
into ed25519 public key bytes.
Trait Implementations§
source§impl Ord for PeerId
impl Ord for PeerId
source§impl PartialEq for PeerId
impl PartialEq for PeerId
source§impl PartialOrd for PeerId
impl PartialOrd for PeerId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for PeerId
impl Eq for PeerId
impl StructuralPartialEq for PeerId
Auto Trait Implementations§
impl Freeze for PeerId
impl RefUnwindSafe for PeerId
impl Send for PeerId
impl Sync for PeerId
impl Unpin for PeerId
impl UnwindSafe for PeerId
Blanket Implementations§
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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> 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