[−][src]Trait undo::Command
Base functionality for all commands.
Required methods
fn apply(&mut self, target: &mut T) -> Result
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 T) -> Result
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
fn redo(&mut self, target: &mut T) -> Result
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(&self) -> Merge
Used for automatic merging of commands.
When commands are merged together, undoing and redoing them are done in one step.
fn text(&self) -> String
Returns the text of the command.