Trait undo::Command [] [src]

pub trait Command<T> {
    fn redo(&mut self, receiver: &mut T) -> Result<(), Box<Error>>;
    fn undo(&mut self, receiver: &mut T) -> Result<(), Box<Error>>;

    fn id(&self) -> Option<u64> { ... }
}

Base functionality for all commands.

Required Methods

Executes the desired command and returns Ok if everything went fine, and Err if something went wrong.

Restores the state as it was before redo was called and returns Ok if everything went fine, and Err if something went wrong.

Provided Methods

Used for automatic merging of Commands.

Two commands are merged together when a command is pushed, and it has the same id as the top command already on the stack. When commands are merged together, undoing and redoing them are done in one step. An example where this is useful is a text editor where you might want to undo a whole word instead of each character.

Trait Implementations

impl<T> Debug for Command<T>
[src]

Formats the value using the given formatter.

Implementors