pub struct CacheItem<T: 'static> { /* private fields */ }
Expand description
Unit of storage in Cache
.
Implementations§
Source§impl<T: 'static> CacheItem<T>
impl<T: 'static> CacheItem<T>
pub fn new(id: &str, data: T) -> CacheItem<T>
Sourcepub fn read<'guard, 'lock: 'guard>(
&'lock self,
) -> Result<RwLockReadGuard<'guard, T>>
pub fn read<'guard, 'lock: 'guard>( &'lock self, ) -> Result<RwLockReadGuard<'guard, T>>
Lock the internal mutex and return a read guard holding the cached data.
Sourcepub fn write<'guard, 'lock: 'guard>(
&'lock self,
) -> Result<RwLockWriteGuard<'guard, T>>
pub fn write<'guard, 'lock: 'guard>( &'lock self, ) -> Result<RwLockWriteGuard<'guard, T>>
Lock the internal mutex and return a write guard holding the cached data.
Auto Trait Implementations§
impl<T> !Freeze for CacheItem<T>
impl<T> RefUnwindSafe for CacheItem<T>
impl<T> Send for CacheItem<T>where
T: Send,
impl<T> Sync for CacheItem<T>
impl<T> Unpin for CacheItem<T>where
T: Unpin,
impl<T> UnwindSafe for CacheItem<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more