pub struct CommandBatch { /* private fields */ }Expand description
A batch of commands that execute and undo together.
Useful for operations that span multiple widgets or steps but should appear as a single undo entry.
Implementations§
Source§impl CommandBatch
impl CommandBatch
Sourcepub fn push(&mut self, cmd: Box<dyn UndoableCmd>)
pub fn push(&mut self, cmd: Box<dyn UndoableCmd>)
Add a command to the batch.
Sourcepub fn push_executed(&mut self, cmd: Box<dyn UndoableCmd>)
pub fn push_executed(&mut self, cmd: Box<dyn UndoableCmd>)
Add a pre-executed command to the batch.
Use this for commands that have already been executed externally. The command will be properly undone when the batch is undone.
Trait Implementations§
Source§impl Debug for CommandBatch
impl Debug for CommandBatch
Source§impl UndoableCmd for CommandBatch
impl UndoableCmd for CommandBatch
Source§fn execute(&mut self) -> CommandResult
fn execute(&mut self) -> CommandResult
Execute the command, applying its effect.
Source§fn undo(&mut self) -> CommandResult
fn undo(&mut self) -> CommandResult
Undo the command, reverting its effect.
Source§fn redo(&mut self) -> CommandResult
fn redo(&mut self) -> CommandResult
Redo the command after it was undone.
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description for UI display.
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Size of this command in bytes for memory budgeting.
Source§fn metadata(&self) -> &CommandMetadata
fn metadata(&self) -> &CommandMetadata
Get the command metadata.
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Downcast to mutable concrete type for merging.
Source§fn debug_name(&self) -> &'static str
fn debug_name(&self) -> &'static str
Debug description of the command.
Source§fn can_merge(&self, _other: &dyn UndoableCmd, _config: &MergeConfig) -> bool
fn can_merge(&self, _other: &dyn UndoableCmd, _config: &MergeConfig) -> bool
Check if this command can merge with another.
Source§fn accept_merge(&mut self, _other: &dyn UndoableCmd) -> bool
fn accept_merge(&mut self, _other: &dyn UndoableCmd) -> bool
Accept a merge from another command. Read more
Auto Trait Implementations§
impl Freeze for CommandBatch
impl !RefUnwindSafe for CommandBatch
impl Send for CommandBatch
impl Sync for CommandBatch
impl Unpin for CommandBatch
impl UnsafeUnpin for CommandBatch
impl !UnwindSafe for CommandBatch
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