Skip to main content

AsyncUndoRedoCommand

Trait AsyncUndoRedoCommand 

Source
pub trait AsyncUndoRedoCommand: UndoRedoCommand {
    // Required methods
    fn start_undo(&mut self) -> Result<()>;
    fn start_redo(&mut self) -> Result<()>;
    fn check_progress(&self) -> f32;
    fn cancel(&mut self) -> Result<()>;
    fn is_complete(&self) -> bool;
}
Expand description

Trait for commands that can be executed asynchronously with progress tracking and cancellation.

This trait extends the basic UndoRedoCommand trait with asynchronous capabilities. Implementors must also implement the UndoRedoCommand trait to ensure compatibility with the existing undo/redo system.

Required Methods§

Source

fn start_undo(&mut self) -> Result<()>

Starts the undo operation asynchronously and returns immediately. Returns Ok(()) if the operation was successfully started.

Source

fn start_redo(&mut self) -> Result<()>

Starts the redo operation asynchronously and returns immediately. Returns Ok(()) if the operation was successfully started.

Source

fn check_progress(&self) -> f32

Checks the progress of the current operation. Returns a value between 0.0 (not started) and 1.0 (completed).

Source

fn cancel(&mut self) -> Result<()>

Attempts to cancel the in-progress operation. Returns Ok(()) if cancellation was successful or if no operation is in progress.

Source

fn is_complete(&self) -> bool

Checks if the current operation is complete. Returns true if the operation has finished successfully.

Implementors§