Struct retainer::entry::CacheExpiration[][src]

pub struct CacheExpiration { /* fields omitted */ }

Small structure to represent expiration in a cache.

Expirations are constructed using the From and Into traits from the standard library; there are no other functions.

There are currently several supported conversions:

  • u64 -> a number of milliseconds to pass before an entry should expire.
  • Instant -> an exact time that an entry should expire.
  • Duration -> a duration to pass before an entry should expire.
  • Range<u64> -> a random range of milliseconds to sample from to determine when an entry should expire.

Other conversions may be added in future, but this should suffice for most cases. Any of these types may be passed to the insertion methods on a cache type when adding entries to a cache.

Implementations

impl CacheExpiration[src]

pub fn instant(&self) -> &Instant[src]

Retrieve the instant associated with this expiration.

pub fn remaining(&self) -> Duration[src]

Retrieve the time remaning before expiration.

Trait Implementations

impl Debug for CacheExpiration[src]

impl From<Duration> for CacheExpiration[src]

impl From<Instant> for CacheExpiration[src]

impl From<Range<u64>> for CacheExpiration[src]

impl From<u64> for CacheExpiration[src]

Auto Trait Implementations

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, 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>,