Struct tentacle_secio::peer_id::PeerId
source · pub struct PeerId { /* private fields */ }
Expand description
Identifier of a peer of the network
The data is a hash of the public key of the peer
Implementations§
source§impl PeerId
impl PeerId
sourcepub fn from_public_key(public_key: &PublicKey) -> Self
pub fn from_public_key(public_key: &PublicKey) -> Self
Builds a PeerId
from a public key.
sourcepub fn from_bytes(data: Vec<u8>) -> Result<Self, Error>
pub fn from_bytes(data: Vec<u8>) -> Result<Self, Error>
If data is a valid PeerId
, return PeerId
, else return error
sourcepub fn into_bytes(self) -> Vec<u8>
pub fn into_bytes(self) -> Vec<u8>
Consume self, return raw bytes representation of this peer id
sourcepub fn is_public_key(&self, public_key: &PublicKey) -> bool
pub fn is_public_key(&self, public_key: &PublicKey) -> bool
Checks whether the public key passed as parameter matches the public key of this PeerId
.
Trait Implementations§
source§impl PartialEq<PeerId> for PeerId
impl PartialEq<PeerId> for PeerId
source§impl PartialOrd<PeerId> for PeerId
impl PartialOrd<PeerId> 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 Eq for PeerId
impl StructuralEq for PeerId
impl StructuralPartialEq for PeerId
Auto Trait Implementations§
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