Struct light_magic::atomic::AtomicDatabase
source · pub struct AtomicDatabase<T: DataStore> { /* private fields */ }Expand description
Synchronized Wrapper, that automatically saves changes when path and tmp are defined
Implementations§
source§impl<T: DataStore + DeserializeOwned> AtomicDatabase<T>
impl<T: DataStore + DeserializeOwned> AtomicDatabase<T>
sourcepub fn load_in_memory() -> Result<Self, Error>
pub fn load_in_memory() -> Result<Self, Error>
Load the database in memory.
sourcepub fn read(&self) -> AtomicDatabaseRead<'_, T>
pub fn read(&self) -> AtomicDatabaseRead<'_, T>
Lock the database for reading.
sourcepub fn write(&self) -> AtomicDatabaseWrite<'_, T>
pub fn write(&self) -> AtomicDatabaseWrite<'_, T>
Lock the database for writing. This will save the changes atomically on drop.
Trait Implementations§
source§impl<T: DataStore> Debug for AtomicDatabase<T>
impl<T: DataStore> Debug for AtomicDatabase<T>
Auto Trait Implementations§
impl<T> !Freeze for AtomicDatabase<T>
impl<T> RefUnwindSafe for AtomicDatabase<T>
impl<T> Send for AtomicDatabase<T>where
T: Send,
impl<T> Sync for AtomicDatabase<T>
impl<T> Unpin for AtomicDatabase<T>where
T: Unpin,
impl<T> UnwindSafe for AtomicDatabase<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