Struct len_caching_lock::mutex::LenCachingMutex  
source · [−]pub struct LenCachingMutex<T: ?Sized> { /* private fields */ }Expand description
Can be used in place of a Mutex where reading T’s len() without
needing to lock, is advantageous.
When the Guard is released, T’s len() will be cached.
The cached len() may be at most 1 lock behind current state.
Implementations
sourceimpl<T: Len> LenCachingMutex<T>
 
impl<T: Len> LenCachingMutex<T>
sourceimpl<T: Len + ?Sized> LenCachingMutex<T>
 
impl<T: Len + ?Sized> LenCachingMutex<T>
sourcepub fn load_len(&self) -> usize
 
pub fn load_len(&self) -> usize
Load the cached value that was returned from your T’s len()
subsequent to the most recent lock being released.
sourcepub fn lock(&self) -> CachingMutexGuard<'_, T>
 
pub fn lock(&self) -> CachingMutexGuard<'_, T>
Delegates to parking_lot::Mutex
lock().
sourcepub fn try_lock(&self) -> Option<CachingMutexGuard<'_, T>>
 
pub fn try_lock(&self) -> Option<CachingMutexGuard<'_, T>>
Delegates to parking_lot::Mutex
try_lock().
Trait Implementations
sourceimpl<T: Debug + ?Sized> Debug for LenCachingMutex<T>
 
impl<T: Debug + ?Sized> Debug for LenCachingMutex<T>
sourceimpl<T: Len + Default> Default for LenCachingMutex<T>
 
impl<T: Len + Default> Default for LenCachingMutex<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for LenCachingMutex<T>
impl<T: ?Sized> Send for LenCachingMutex<T> where
    T: Send, 
impl<T: ?Sized> Sync for LenCachingMutex<T> where
    T: Send, 
impl<T: ?Sized> Unpin for LenCachingMutex<T> where
    T: Unpin, 
impl<T: ?Sized> UnwindSafe for LenCachingMutex<T> where
    T: UnwindSafe, 
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
 
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more