pub struct CommandHistory { /* private fields */ }Expand description
Command history manager
Implementations§
Source§impl CommandHistory
impl CommandHistory
pub fn new(config: HistoryConfig) -> Self
Sourcepub fn execute(&mut self, command: Box<dyn Command>) -> CommandResult
pub fn execute(&mut self, command: Box<dyn Command>) -> CommandResult
Execute a command and add to history
Sourcepub fn undo(&mut self) -> Option<CommandResult>
pub fn undo(&mut self) -> Option<CommandResult>
Undo the last command
Sourcepub fn redo(&mut self) -> Option<CommandResult>
pub fn redo(&mut self) -> Option<CommandResult>
Redo the last undone command
Sourcepub fn undo_count(&self) -> usize
pub fn undo_count(&self) -> usize
Get number of undoable commands
Sourcepub fn redo_count(&self) -> usize
pub fn redo_count(&self) -> usize
Get number of redoable commands
Sourcepub fn undo_description(&self) -> Option<&str>
pub fn undo_description(&self) -> Option<&str>
Get description of next undo command
Sourcepub fn redo_description(&self) -> Option<&str>
pub fn redo_description(&self) -> Option<&str>
Get description of next redo command
Sourcepub fn begin_group(&mut self) -> GroupId
pub fn begin_group(&mut self) -> GroupId
Start a command group
Sourcepub fn execute_group<I>(&mut self, commands: I) -> Vec<CommandResult>
pub fn execute_group<I>(&mut self, commands: I) -> Vec<CommandResult>
Execute multiple commands as a group
Sourcepub fn create_checkpoint(&mut self, name: impl Into<String>) -> CheckpointId
pub fn create_checkpoint(&mut self, name: impl Into<String>) -> CheckpointId
Create a checkpoint at current position
Sourcepub fn restore_checkpoint(&mut self, id: CheckpointId) -> bool
pub fn restore_checkpoint(&mut self, id: CheckpointId) -> bool
Restore to a checkpoint
Sourcepub fn get_checkpoint(&self, id: CheckpointId) -> Option<&Checkpoint>
pub fn get_checkpoint(&self, id: CheckpointId) -> Option<&Checkpoint>
Get checkpoint by ID
Sourcepub fn checkpoints(&self) -> impl Iterator<Item = &Checkpoint>
pub fn checkpoints(&self) -> impl Iterator<Item = &Checkpoint>
List all checkpoints
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Get current memory usage
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Check if recording
Sourcepub fn on_event(&mut self, callback: HistoryCallback)
pub fn on_event(&mut self, callback: HistoryCallback)
Add event listener