Struct ckb_network::PeerId
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§
§impl PeerId
impl PeerId
pub fn from_public_key(public_key: &PublicKey) -> PeerId
pub fn from_public_key(public_key: &PublicKey) -> PeerId
Builds a PeerId from a public key.
pub fn from_bytes(data: Vec<u8, Global>) -> Result<PeerId, Error>
pub fn from_bytes(data: Vec<u8, Global>) -> Result<PeerId, Error>
If data is a valid PeerId, return PeerId, else return error
pub fn into_bytes(self) -> Vec<u8, Global> ⓘ
pub fn into_bytes(self) -> Vec<u8, Global> ⓘ
Consume self, return raw bytes representation of this peer id
pub 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§
§impl PartialOrd<PeerId> for PeerId
impl PartialOrd<PeerId> for PeerId
§fn partial_cmp(&self, other: &PeerId) -> Option<Ordering>
fn partial_cmp(&self, other: &PeerId) -> Option<Ordering>
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 more