[][src]Struct tentacle_secio::peer_id::PeerId

pub struct PeerId { /* fields omitted */ }

Identifier of a peer of the network

The data is a hash of the public key of the peer

Methods

impl PeerId[src]

pub fn from_public_key(public_key: &PublicKey) -> Self[src]

Builds a PeerId from a public key.

pub fn from_bytes(data: Vec<u8>) -> Result<Self, ()>[src]

If data is a valid PeerId, return PeerId, else return error

pub fn random() -> Self[src]

Return a random PeerId

pub fn as_bytes(&self) -> &[u8][src]

Return raw bytes representation of this peer id

pub fn into_bytes(self) -> Vec<u8>[src]

Consume self, return raw bytes representation of this peer id

pub fn to_base58(&self) -> String[src]

Returns a base-58 encoded string of this PeerId.

pub fn digest(&self) -> &[u8][src]

Returns the raw bytes of the hash of this PeerId.

pub fn is_public_key(&self, public_key: &PublicKey) -> bool[src]

Checks whether the public key passed as parameter matches the public key of this PeerId.

Trait Implementations

impl Clone for PeerId[src]

impl Debug for PeerId[src]

impl Eq for PeerId[src]

impl From<PublicKey> for PeerId[src]

impl FromStr for PeerId[src]

type Err = ()

The associated error which can be returned from parsing.

impl Hash for PeerId[src]

impl PartialEq<PeerId> for PeerId[src]

impl PartialOrd<PeerId> for PeerId[src]

impl StructuralEq for PeerId[src]

impl StructuralPartialEq for PeerId[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,