Struct undo::record::Checkpoint

source ·
pub struct Checkpoint<'a, A, S> { /* private fields */ }
Expand description

Wraps a record and gives it checkpoint functionality.

Implementations§

source§

impl<A, S> Checkpoint<'_, A, S>

source

pub fn queue(&mut self) -> Queue<'_, A, S>

Returns a queue.

source

pub fn checkpoint(&mut self) -> Checkpoint<'_, A, S>

Returns a checkpoint.

source§

impl<A: Action, S: Slot> Checkpoint<'_, A, S>

source

pub fn apply(&mut self, target: &mut A::Target, action: A) -> A::Output

Calls the apply method.

source

pub fn undo(&mut self, target: &mut A::Target) -> Option<A::Output>

Calls the undo method.

source

pub fn redo(&mut self, target: &mut A::Target) -> Option<A::Output>

Calls the redo method.

source

pub fn commit(self)

Commits the changes and consumes the checkpoint.

source

pub fn cancel(self, target: &mut A::Target) -> Vec<A::Output>

Cancels the changes and consumes the checkpoint.

Trait Implementations§

source§

impl<'a, A: Debug, S: Debug> Debug for Checkpoint<'a, A, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, A, S> From<&'a mut Record<A, S>> for Checkpoint<'a, A, S>

source§

fn from(record: &'a mut Record<A, S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, A, S> RefUnwindSafe for Checkpoint<'a, A, S>where A: RefUnwindSafe, S: RefUnwindSafe,

§

impl<'a, A, S> Send for Checkpoint<'a, A, S>where A: Send, S: Send,

§

impl<'a, A, S> Sync for Checkpoint<'a, A, S>where A: Sync, S: Sync,

§

impl<'a, A, S> Unpin for Checkpoint<'a, A, S>where A: Unpin,

§

impl<'a, A, S> !UnwindSafe for Checkpoint<'a, A, S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.