pub struct AtomicFile { /* private fields */ }Expand description
Based on BasicAtomicFile which makes sure that updates are all-or-nothing. Performs commit asyncronously.
#Example
use atom_file::{AtomicFile,DummyFile,MemFile,Storage};
let mut af = AtomicFile::new(MemFile::new(), DummyFile::new());
af.write( 0, &[1,2,3,4] );
af.commit(4);
af.wait_complete();Implementations§
Trait Implementations§
Source§impl Storage for AtomicFile
impl Storage for AtomicFile
Source§fn commit(&mut self, size: u64)
fn commit(&mut self, size: u64)
Finish write transaction, size is new size of underlying storage.
Source§fn size(&self) -> u64
fn size(&self) -> u64
Get the size of the underlying storage.
Note : this is valid initially and after a commit but is not defined after write is called.
Source§fn wait_complete(&self)
fn wait_complete(&self)
Wait until current writes are complete.
Auto Trait Implementations§
impl Freeze for AtomicFile
impl RefUnwindSafe for AtomicFile
impl Send for AtomicFile
impl Sync for AtomicFile
impl Unpin for AtomicFile
impl UnsafeUnpin for AtomicFile
impl UnwindSafe for AtomicFile
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