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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandHistory
impl !RefUnwindSafe for CommandHistory
impl Send for CommandHistory
impl Sync for CommandHistory
impl Unpin for CommandHistory
impl !UnwindSafe for CommandHistory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().