[][src]Struct associative_cache::replacement::lru::WithLruTimestamp

pub struct WithLruTimestamp<T> { /* fields omitted */ }

A wrapper around a T cache value that maintains a timestamp for use with LRU cache replacement policies.

Provides Deref[Mut] and As{Ref,Mut} implementations, so it is easy to drop in with minimal source changes.

You can recover ownership of the inner T value via WithLruTimestamp::into_inner(x) once a value has been removed from the cache.

Example

use associative_cache::*;

let cache = AssociativeCache::<
    String,
    // Wrap your cache value in `WithLruTimestamp`...
    WithLruTimestamp<usize>,
    Capacity128,
    HashEightWay,
    // ... and take advantage of LRU cache replacement!
    LruReplacement,
>::default();

Methods

impl<T> WithLruTimestamp<T>[src]

pub fn new(inner: T) -> WithLruTimestamp<T>[src]

Construct a new WithLruTimestamp wrapper around an inner value.

Example

use associative_cache::*;

let inner = "hello!".to_string();
let outer = WithLruTimestamp::new(inner);

pub fn into_inner(outer: WithLruTimestamp<T>) -> T[src]

Recover the inner T value by consuming a WithLruTimestamp<T>.

Example

use associative_cache::*;

let outer = WithLruTimestamp::new("hello!".to_string());
let inner = WithLruTimestamp::into_inner(outer);
assert_eq!(inner, "hello!");

Trait Implementations

impl<T> LruTimestamp for WithLruTimestamp<T>[src]

type Timestamp = Cell<Instant>

The timestamp type that will be compared. Read more

impl<T> From<T> for WithLruTimestamp<T>[src]

impl<T> AsMut<T> for WithLruTimestamp<T>[src]

impl<T: Clone> Clone for WithLruTimestamp<T>[src]

impl<T> Default for WithLruTimestamp<T> where
    T: Default
[src]

impl<T: PartialOrd> PartialOrd<WithLruTimestamp<T>> for WithLruTimestamp<T>[src]

impl<T> AsRef<T> for WithLruTimestamp<T>[src]

impl<T: Eq> Eq for WithLruTimestamp<T>[src]

impl<T: Ord> Ord for WithLruTimestamp<T>[src]

impl<T: PartialEq> PartialEq<WithLruTimestamp<T>> for WithLruTimestamp<T>[src]

impl<T> Deref for WithLruTimestamp<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for WithLruTimestamp<T>[src]

impl<T: Debug> Debug for WithLruTimestamp<T>[src]

Auto Trait Implementations

impl<T> Send for WithLruTimestamp<T> where
    T: Send

impl<T> !Sync for WithLruTimestamp<T>

impl<T> Unpin for WithLruTimestamp<T> where
    T: Unpin

impl<T> !RefUnwindSafe for WithLruTimestamp<T>

impl<T> UnwindSafe for WithLruTimestamp<T> where
    T: UnwindSafe

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,