Enum cache::Cached [−][src]
pub enum Cached<'a, V: 'a> { Spilled(Box<V>), Cached { guard: RwLockReadGuard<'a, ()>, ptr: *const ManuallyDrop<V>, }, Borrowed(&'a V), }
A reference type to a value in the cache, either carrying the value itself (if an insert failed), or a readlock into the memory slab.
Variants
Spilled(Box<V>)
Value could not be put on the cache, and is returned in a box
as to be able to implement StableDeref
Cached
Value resides in cache and is read-locked.
Fields of Cached
guard: RwLockReadGuard<'a, ()> | The readguard from a lock on the heap |
ptr: *const ManuallyDrop<V> | A pointer to a value on the heap |
Borrowed(&'a V)
A value that was borrowed from outside the cache.
Methods
impl<'a, V: 'a> Cached<'a, V>
[src]
impl<'a, V: 'a> Cached<'a, V>
impl<'a, V: 'a + Clone> Cached<'a, V>
[src]
impl<'a, V: 'a + Clone> Cached<'a, V>
pub fn into_owned(self) -> V
[src]
pub fn into_owned(self) -> V
Turns the cached value into an owned value by cloning
Trait Implementations
impl<'a, V> StableAddress for Cached<'a, V>
[src]
impl<'a, V> StableAddress for Cached<'a, V>
impl<'a, V> Debug for Cached<'a, V> where
V: Debug,
[src]
impl<'a, V> Debug for Cached<'a, V> where
V: Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<'a, V> Deref for Cached<'a, V>
[src]
impl<'a, V> Deref for Cached<'a, V>