[−]Struct ckb_network::PeerId
Identifier of a peer of the network
The data is a hash of the public key of the peer
Implementations
impl 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, ()>
If data is a valid PeerId
, return PeerId
, else return error
pub fn random() -> PeerId
Return a random PeerId
pub fn as_bytes(&self) -> &[u8]
Return raw bytes representation of this peer id
pub fn into_bytes(self) -> Vec<u8, Global>
Consume self, return raw bytes representation of this peer id
pub fn to_base58(&self) -> String
Returns a base-58 encoded string of this PeerId
.
pub fn digest(&self) -> &[u8]
Returns the raw bytes of the hash of this PeerId
.
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 Clone for PeerId
pub fn clone(&self) -> PeerId
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PeerId
impl Eq for PeerId
impl From<PublicKey> for PeerId
impl FromStr for PeerId
type Err = ()
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<PeerId, <PeerId as FromStr>::Err>
impl Hash for PeerId
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<PeerId> for PeerId
impl PartialOrd<PeerId> for PeerId
pub fn partial_cmp(&self, other: &PeerId) -> Option<Ordering>
pub fn lt(&self, other: &PeerId) -> bool
pub fn le(&self, other: &PeerId) -> bool
pub fn gt(&self, other: &PeerId) -> bool
pub fn ge(&self, other: &PeerId) -> bool
impl StructuralEq for PeerId
impl StructuralPartialEq for PeerId
Auto Trait Implementations
impl RefUnwindSafe for PeerId
[src]
impl Send for PeerId
[src]
impl Sync for PeerId
[src]
impl Unpin for PeerId
[src]
impl UnwindSafe for PeerId
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,