Struct retainer::entry::CacheExpiration [−][src]
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
impl RefUnwindSafe for CacheExpiration
[src]
impl Send for CacheExpiration
[src]
impl Sync for CacheExpiration
[src]
impl Unpin for CacheExpiration
[src]
impl UnwindSafe for CacheExpiration
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,