Trait undo::Action[][src]

pub trait Action {
    type Target;
    type Output;
    type Error;
    fn apply(&mut self, target: &mut Self::Target) -> Result<Self>;
fn undo(&mut self, target: &mut Self::Target) -> Result<Self>; fn redo(&mut self, target: &mut Self::Target) -> Result<Self> { ... }
fn merge(&mut self, _: &mut Self) -> Merged
    where
        Self: Sized
, { ... } }
Expand description

Base functionality for all actions.

Associated Types

The target type.

The output type.

The error type.

Required methods

Applies the action on the target and returns Ok if everything went fine, and Err if something went wrong.

Restores the state of the target as it was before the action was applied and returns Ok if everything went fine, and Err if something went wrong.

Provided methods

Reapplies the action on the target and return Ok if everything went fine, and Err if something went wrong.

The default implementation uses the apply implementation.

Used for manual merging of actions.

Implementors