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) -> PeerId
pub fn from_public_key(public_key: &PublicKey) -> PeerId
Builds a PeerId from a public key.
Sourcepub fn from_bytes(data: Vec<u8>) -> Result<PeerId, Error>
pub fn from_bytes(data: Vec<u8>) -> Result<PeerId, 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 PartialOrd for PeerId
impl PartialOrd 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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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