[][src]Struct hyparview::TimeToLive

pub struct TimeToLive(_);

TTL of a message.

It decreases by one each time the message is forwarded. If the TTL of a message reaches zero, the message will be handled by the node that keeps the message at the time. So, a TTL can be regarded as the hop count of a message.

Methods

impl TimeToLive[src]

pub fn new(ttl: u8) -> Self[src]

Makes a new TimeToLive instance.

pub fn as_u8(self) -> u8[src]

Returns the value of the TTL.

pub fn is_expired(self) -> bool[src]

Returns true if the TTL is expired, otherwise false.

Examples

use hyparview::TimeToLive;

let ttl = TimeToLive::new(10);
assert!(!ttl.is_expired());

let ttl = TimeToLive::new(0);
assert!(ttl.is_expired());

Trait Implementations

impl Eq for TimeToLive[src]

impl Clone for TimeToLive[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for TimeToLive[src]

impl PartialOrd<TimeToLive> for TimeToLive[src]

impl PartialEq<TimeToLive> for TimeToLive[src]

impl Ord for TimeToLive[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Hash for TimeToLive[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for TimeToLive[src]

Auto Trait Implementations

impl Send for TimeToLive

impl Sync for TimeToLive

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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