[][src]Struct poldercast::Id

pub struct Id(_);

this is a poldercast unique identifier.

It can be used for different purposes:

  • the unique identifier the a node identifies itself within the topology;
  • a mean to compare 2 nodes within the topology

TODO: highlights which module is utilizing the Id for proximity (I think this is rings).

There is 2 ways to create a new Id:

  1. you can [compute] from an address:
    let address: Address = "/ip4/127.0.0.1/tcp/8080".parse()?;
    let id = Id::compute(&address);
  2. you can manually construct one;
    let id = Id::from(9283991);

Methods

impl Id[src]

pub fn compute(address: &Address) -> Self[src]

generate a new identifier utilizing the given Random Number Generator (RNG).

Trait Implementations

impl From<[u8; 8]> for Id[src]

impl From<u64> for Id[src]

impl From<Id> for u64[src]

impl Clone for Id[src]

impl PartialOrd<Id> for Id[src]

impl Copy for Id[src]

impl Eq for Id[src]

impl Ord for Id[src]

impl PartialEq<Id> for Id[src]

impl Debug for Id[src]

impl Hash for Id[src]

Auto Trait Implementations

impl Send for Id

impl Sync for Id

impl Unpin for Id

impl UnwindSafe for Id

impl RefUnwindSafe for Id

Blanket Implementations

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<T> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self