pub struct Checkpoint { /* private fields */ }Expand description
A checkpoint that captures the current oplog index and can revert execution back to it.
Implementations§
Source§impl Checkpoint
impl Checkpoint
Sourcepub fn run_or_revert<T, E>(&self, f: impl FnOnce() -> Result<T, E>) -> T
pub fn run_or_revert<T, E>(&self, f: impl FnOnce() -> Result<T, E>) -> T
Runs the given function, reverting to the checkpoint on error.
Sourcepub async fn run_or_revert_async<T, E, F: Future<Output = Result<T, E>>>(
&self,
f: impl FnOnce() -> F,
) -> T
pub async fn run_or_revert_async<T, E, F: Future<Output = Result<T, E>>>( &self, f: impl FnOnce() -> F, ) -> T
Runs the given async function, reverting to the checkpoint on error.
Sourcepub fn assert_or_revert(&self, condition: bool)
pub fn assert_or_revert(&self, condition: bool)
Reverts to the checkpoint if the condition is false.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnsafeUnpin for Checkpoint
impl UnwindSafe for Checkpoint
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