pub struct EncryptedAtomicDatabase<T: EncryptedDataStore> { /* private fields */ }Expand description
Synchronized Wrapper, that automatically saves changes when path and tmp are defined
Implementations§
source§impl<T: EncryptedDataStore + DeserializeOwned> EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore + DeserializeOwned> EncryptedAtomicDatabase<T>
sourcepub fn load<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
pub fn load<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
Load the database from the file system with the provided password.
sourcepub fn create<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
pub fn create<P: AsRef<Path>>(path: P, password: &str) -> Result<Self>
Create a new database and save it with the provided password.
sourcepub fn read(&self) -> EncryptedAtomicDatabaseRead<'_, T>
pub fn read(&self) -> EncryptedAtomicDatabaseRead<'_, T>
Lock the database for reading.
sourcepub fn write(&self) -> EncryptedAtomicDatabaseWrite<'_, T>
pub fn write(&self) -> EncryptedAtomicDatabaseWrite<'_, T>
Lock the database for writing. This will save the changes atomically on drop.
sourcepub fn change_password(&self, new_password: &str) -> Result<()>
pub fn change_password(&self, new_password: &str) -> Result<()>
Change the password of the database. This will re-encrypt the data with a new key derived from the new password.
Trait Implementations§
source§impl<T: EncryptedDataStore> Debug for EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore> Debug for EncryptedAtomicDatabase<T>
source§impl<T: EncryptedDataStore> Drop for EncryptedAtomicDatabase<T>
impl<T: EncryptedDataStore> Drop for EncryptedAtomicDatabase<T>
Auto Trait Implementations§
impl<T> !Freeze for EncryptedAtomicDatabase<T>
impl<T> RefUnwindSafe for EncryptedAtomicDatabase<T>
impl<T> Send for EncryptedAtomicDatabase<T>where
T: Send,
impl<T> Sync for EncryptedAtomicDatabase<T>
impl<T> Unpin for EncryptedAtomicDatabase<T>where
T: Unpin,
impl<T> UnwindSafe for EncryptedAtomicDatabase<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