Struct kaspa_database::prelude::CachedDbItem
source · pub struct CachedDbItem<T> { /* private fields */ }Expand description
A cached DB item with concurrency support
Implementations§
source§impl<T> CachedDbItem<T>
impl<T> CachedDbItem<T>
pub fn new(db: Arc<DB>, key: Vec<u8>) -> Self
pub fn read(&self) -> Result<T, StoreError>where
T: Clone + DeserializeOwned,
pub fn write( &mut self, writer: impl DbWriter, item: &T ) -> Result<(), StoreError>
pub fn remove(&mut self, writer: impl DbWriter) -> Result<(), StoreError>
pub fn update<F>( &mut self, writer: impl DbWriter, op: F ) -> Result<T, StoreError>
Trait Implementations§
source§impl<T: Clone> Clone for CachedDbItem<T>
impl<T: Clone> Clone for CachedDbItem<T>
source§fn clone(&self) -> CachedDbItem<T>
fn clone(&self) -> CachedDbItem<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> !RefUnwindSafe for CachedDbItem<T>
impl<T> Send for CachedDbItem<T>
impl<T> Sync for CachedDbItem<T>
impl<T> Unpin for CachedDbItem<T>
impl<T> !UnwindSafe for CachedDbItem<T>
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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