Skip to main content

EditorCommand

Trait EditorCommand 

Source
pub trait EditorCommand:
    Debug
    + Send
    + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute(&mut self, state: &mut EditorState);
    fn undo(&mut self, state: &mut EditorState);
}
Expand description

Trait that every undoable editor command must implement.

Required Methods§

Source

fn name(&self) -> &str

Human-readable name for display in the undo stack.

Source

fn execute(&mut self, state: &mut EditorState)

Apply / re-apply the command.

Source

fn undo(&mut self, state: &mut EditorState)

Reverse the command.

Implementors§