[−][src]Struct associative_cache::replacement::lru::WithLruTimestamp
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
fn get_timestamp(&self) -> &Self::Timestamp
[src]
fn update_timestamp(&self)
[src]
impl<T> From<T> for WithLruTimestamp<T>
[src]
fn from(inner: T) -> WithLruTimestamp<T>
[src]
impl<T> AsMut<T> for WithLruTimestamp<T>
[src]
impl<T: Clone> Clone for WithLruTimestamp<T>
[src]
fn clone(&self) -> WithLruTimestamp<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Default for WithLruTimestamp<T> where
T: Default,
[src]
T: Default,
impl<T: PartialOrd> PartialOrd<WithLruTimestamp<T>> for WithLruTimestamp<T>
[src]
fn partial_cmp(&self, other: &WithLruTimestamp<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &WithLruTimestamp<T>) -> bool
[src]
fn le(&self, other: &WithLruTimestamp<T>) -> bool
[src]
fn gt(&self, other: &WithLruTimestamp<T>) -> bool
[src]
fn ge(&self, other: &WithLruTimestamp<T>) -> bool
[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]
fn cmp(&self, other: &WithLruTimestamp<T>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq> PartialEq<WithLruTimestamp<T>> for WithLruTimestamp<T>
[src]
fn eq(&self, other: &WithLruTimestamp<T>) -> bool
[src]
fn ne(&self, other: &WithLruTimestamp<T>) -> bool
[src]
impl<T> Deref for WithLruTimestamp<T>
[src]
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,
T: Send,
impl<T> !Sync for WithLruTimestamp<T>
impl<T> Unpin for WithLruTimestamp<T> where
T: Unpin,
T: Unpin,
impl<T> !RefUnwindSafe for WithLruTimestamp<T>
impl<T> UnwindSafe for WithLruTimestamp<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,