Struct len_caching_lock::rwlock::LenCachingRwLock
source · [−]pub struct LenCachingRwLock<T: ?Sized> { /* private fields */ }
Expand description
Can be used in place of a RwLock
where
reading T
’s len()
without needing to lock, is advantageous.
When the WriteGuard is released, T
’s len()
will be cached.
Implementations
sourceimpl<T: Len> LenCachingRwLock<T>
impl<T: Len> LenCachingRwLock<T>
sourceimpl<T: Len + ?Sized> LenCachingRwLock<T>
impl<T: Len + ?Sized> LenCachingRwLock<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 write(&self) -> CachingRwLockWriteGuard<'_, T>
pub fn write(&self) -> CachingRwLockWriteGuard<'_, T>
Delegates to parking_lot::RwLock
write()
.
sourcepub fn try_write(&self) -> Option<CachingRwLockWriteGuard<'_, T>>
pub fn try_write(&self) -> Option<CachingRwLockWriteGuard<'_, T>>
Delegates to parking_lot::RwLock
try_write()
.
sourcepub fn read(&self) -> RwLockReadGuard<'_, T>
pub fn read(&self) -> RwLockReadGuard<'_, T>
Delegates to parking_lot::RwLock
read()
.
sourcepub fn try_read(&self) -> Option<RwLockReadGuard<'_, T>>
pub fn try_read(&self) -> Option<RwLockReadGuard<'_, T>>
Delegates to parking_lot::RwLock
try_read()
.
Trait Implementations
sourceimpl<T: Debug + ?Sized> Debug for LenCachingRwLock<T>
impl<T: Debug + ?Sized> Debug for LenCachingRwLock<T>
sourceimpl<T: Len + Default> Default for LenCachingRwLock<T>
impl<T: Len + Default> Default for LenCachingRwLock<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for LenCachingRwLock<T>
impl<T: ?Sized> Send for LenCachingRwLock<T> where
T: Send,
impl<T: ?Sized> Sync for LenCachingRwLock<T> where
T: Send + Sync,
impl<T: ?Sized> Unpin for LenCachingRwLock<T> where
T: Unpin,
impl<T: ?Sized> UnwindSafe for LenCachingRwLock<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