Trait undo::Action[][src]

pub trait Action {
    type Target;
    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 { ... } }

Base functionality for all actions.

Associated Types

type Target[src]

The target type.

type Error[src]

The error type.

Loading content...

Required methods

fn apply(&mut self, target: &mut Self::Target) -> Result<Self>[src]

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

fn undo(&mut self, target: &mut Self::Target) -> Result<Self>[src]

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.

Loading content...

Provided methods

fn redo(&mut self, target: &mut Self::Target) -> Result<Self>[src]

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.

fn merge(&mut self, _: &mut Self) -> Merged[src]

Used for manual merging of actions.

Loading content...

Implementors

Loading content...