Trait redo::Command[][src]

pub trait Command: Sized {
    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, command: Self) -> Merge<Self> { ... } }
Expand description

Base functionality for all commands.

Associated Types

The target type.

The error type.

Required methods

Applies the command 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 command was applied and returns Ok if everything went fine, and Err if something went wrong.

Provided methods

Reapplies the command 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 commands.

Implementors