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() -> Self
pub fn load_in_memory() -> Self
Loads the database in memory.
Sourcepub fn read(&self) -> AtomicDatabaseRead<'_, T>
pub fn read(&self) -> AtomicDatabaseRead<'_, T>
Locks the database for reading.
Sourcepub fn write(&self) -> AtomicDatabaseWrite<'_, T>
pub fn write(&self) -> AtomicDatabaseWrite<'_, T>
Locks 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>where
T: UnwindSafe,
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