[−][src]Struct hyparview::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 PartialEq<TimeToLive> for TimeToLive
[src]
fn eq(&self, other: &TimeToLive) -> bool
[src]
fn ne(&self, other: &TimeToLive) -> bool
[src]
impl PartialOrd<TimeToLive> for TimeToLive
[src]
fn partial_cmp(&self, other: &TimeToLive) -> Option<Ordering>
[src]
fn lt(&self, other: &TimeToLive) -> bool
[src]
fn le(&self, other: &TimeToLive) -> bool
[src]
fn gt(&self, other: &TimeToLive) -> bool
[src]
fn ge(&self, other: &TimeToLive) -> bool
[src]
impl Eq for TimeToLive
[src]
impl Copy for TimeToLive
[src]
impl Ord for TimeToLive
[src]
fn cmp(&self, other: &TimeToLive) -> Ordering
[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 Clone for TimeToLive
[src]
fn clone(&self) -> TimeToLive
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for TimeToLive
[src]
impl Hash 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]
U: From<T>,
impl<T> From for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,