[][src]Trait redo::Command

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> { ... } }

Base functionality for all commands.

Associated Types

type Target

The target type.

type Error

The error type.

Loading content...

Required methods

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

Applies the command 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>

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.

Loading content...

Provided methods

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

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.

fn merge(&mut self, command: Self) -> Merge<Self>

Used for manual merging of commands.

Loading content...

Implementors

Loading content...