CommandHistory

Struct CommandHistory 

Source
pub struct CommandHistory { /* private fields */ }
Expand description

Command history manager

Implementations§

Source§

impl CommandHistory

Source

pub fn new(config: HistoryConfig) -> Self

Source

pub fn execute(&mut self, command: Box<dyn Command>) -> CommandResult

Execute a command and add to history

Source

pub fn undo(&mut self) -> Option<CommandResult>

Undo the last command

Source

pub fn redo(&mut self) -> Option<CommandResult>

Redo the last undone command

Source

pub fn can_undo(&self) -> bool

Check if undo is available

Source

pub fn can_redo(&self) -> bool

Check if redo is available

Source

pub fn undo_count(&self) -> usize

Get number of undoable commands

Source

pub fn redo_count(&self) -> usize

Get number of redoable commands

Source

pub fn undo_description(&self) -> Option<&str>

Get description of next undo command

Source

pub fn redo_description(&self) -> Option<&str>

Get description of next redo command

Source

pub fn begin_group(&mut self) -> GroupId

Start a command group

Source

pub fn end_group(&mut self)

End current command group

Source

pub fn execute_group<I>(&mut self, commands: I) -> Vec<CommandResult>
where I: IntoIterator<Item = Box<dyn Command>>,

Execute multiple commands as a group

Source

pub fn create_checkpoint(&mut self, name: impl Into<String>) -> CheckpointId

Create a checkpoint at current position

Source

pub fn restore_checkpoint(&mut self, id: CheckpointId) -> bool

Restore to a checkpoint

Source

pub fn get_checkpoint(&self, id: CheckpointId) -> Option<&Checkpoint>

Get checkpoint by ID

Source

pub fn checkpoints(&self) -> impl Iterator<Item = &Checkpoint>

List all checkpoints

Source

pub fn clear(&mut self)

Clear all history

Source

pub fn memory_usage(&self) -> usize

Get current memory usage

Source

pub fn tick(&mut self, delta_ms: u64)

Update timestamp (call each frame or periodically)

Source

pub fn pause(&mut self)

Pause recording

Source

pub fn resume(&mut self)

Resume recording

Source

pub fn is_recording(&self) -> bool

Check if recording

Source

pub fn on_event(&mut self, callback: HistoryCallback)

Add event listener

Trait Implementations§

Source§

impl Default for CommandHistory

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.