Skip to main content

UndoRedoCommand

Trait UndoRedoCommand 

Source
pub trait UndoRedoCommand {
    // Required methods
    fn name(&self) -> &str;
    fn do_it(&mut self);
    fn undo_it(&mut self);
}
Expand description

A named, reversible operation.

Implement this trait to participate in the shared undo/redo stack. The do_it / undo_it methods are called by UndoBuffer on redo and undo respectively.

Required Methods§

Source

fn name(&self) -> &str

Short human-readable description, e.g. "insert text".

Source

fn do_it(&mut self)

Re-apply the operation (called on Redo).

Source

fn undo_it(&mut self)

Reverse the operation (called on Undo).

Implementors§