pub struct LRUCache<V, K, T, M> { /* private fields */ }
Expand description

A generational-arena powered LRUCache implementation.

Implementations§

source§

impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>,

source

pub fn least_recent(&self) -> Option<(&K, &T)>

source

pub fn most_recent(&self) -> Option<(&K, &T)>

source§

impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>,

source

pub fn with_backing_vector_and_map(vector: V, map: M) -> Self

source§

impl<V, K, T, M> LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link> + Default,

source

pub fn with_backing_vector(vector: V) -> Self

Trait Implementations§

source§

impl<V, K, T, M> Cache<K, T> for LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>>, M: Map<K, Link>, K: Copy,

§

type Error = LRUCacheError<<V as Vector<Entry<Node<Block<K, T>>>>>::Error, <M as Map<K, Link>>::Error>

source§

fn insert(&mut self, key: K, value: T) -> Result<Eviction<K, T>, Self::Error>

source§

fn remove(&mut self, key: &K) -> Result<Lookup<T>, Self::Error>

source§

fn shrink(&mut self, new_capacity: usize) -> Result<(), Self::Error>

source§

fn reserve(&mut self, additional: usize) -> Result<(), Self::Error>

source§

fn query(&mut self, key: &K) -> Result<Lookup<&T>, Self::Error>

source§

fn capacity(&self) -> usize

source§

fn len(&self) -> usize

source§

fn is_empty(&self) -> bool

source§

fn clear(&mut self) -> Result<(), Self::Error>

source§

fn is_maxed(&self) -> bool

source§

impl<V, K, T, M> Default for LRUCache<V, K, T, M>where V: Vector<LRUCacheBlockArenaEntry<K, T>> + Default, M: Map<K, Link> + Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<V, K, T, M> RefUnwindSafe for LRUCache<V, K, T, M>where K: RefUnwindSafe, M: RefUnwindSafe, T: RefUnwindSafe, V: RefUnwindSafe,

§

impl<V, K, T, M> Send for LRUCache<V, K, T, M>where K: Send, M: Send, T: Send, V: Send,

§

impl<V, K, T, M> Sync for LRUCache<V, K, T, M>where K: Sync, M: Sync, T: Sync, V: Sync,

§

impl<V, K, T, M> Unpin for LRUCache<V, K, T, M>where K: Unpin, M: Unpin, T: Unpin, V: Unpin,

§

impl<V, K, T, M> UnwindSafe for LRUCache<V, K, T, M>where K: UnwindSafe, M: UnwindSafe, T: UnwindSafe, V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.