pub struct Journal { /* private fields */ }Expand description
An open journal. Its file exists until Journal::finish removes it.
Implementations§
Source§impl Journal
impl Journal
Sourcepub fn begin(
path: &Utf8Path,
backups: &Utf8Path,
entries: Vec<Entry>,
) -> Result<Self, AppError>
pub fn begin( path: &Utf8Path, backups: &Utf8Path, entries: Vec<Entry>, ) -> Result<Self, AppError>
Write the journal before the first replacement.
§Errors
Any I/O error writing or syncing the journal.
Sourcepub fn mark_done(&mut self, destination: &Utf8Path) -> Result<(), AppError>
pub fn mark_done(&mut self, destination: &Utf8Path) -> Result<(), AppError>
Mark one destination as reached, and rewrite the journal.
§Errors
Any I/O error rewriting the journal.
Sourcepub fn roll_back(&self) -> Result<(), AppError>
pub fn roll_back(&self) -> Result<(), AppError>
Put every reached destination back, then remove the journal.
§Errors
AppError::Unrecovered when a destination cannot be put back.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Journal
impl RefUnwindSafe for Journal
impl Send for Journal
impl Sync for Journal
impl Unpin for Journal
impl UnsafeUnpin for Journal
impl UnwindSafe for Journal
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