pub struct CommandStack { /* private fields */ }Implementations§
Source§impl CommandStack
impl CommandStack
pub fn new(max_depth: usize) -> Self
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
pub fn execute(&mut self, cmd: Command, score: &mut Score) -> Result<(), Error>
pub fn undo(&mut self, score: &mut Score) -> Result<ChangeHint, Error>
pub fn redo(&mut self, score: &mut Score) -> Result<ChangeHint, Error>
Sourcepub fn history_commands(&self) -> Vec<Command>
pub fn history_commands(&self) -> Vec<Command>
Return the commands applied so far, in execution order.
Suitable for use with [ScoreEngine::export_history].
Sourcepub fn undo_label(&self) -> Option<String>
pub fn undo_label(&self) -> Option<String>
Label of the command that would be undone next, for UI display (e.g. “Undo: Add Note”).
Sourcepub fn redo_label(&self) -> Option<String>
pub fn redo_label(&self) -> Option<String>
Label of the command that would be redone next, for UI display (e.g. “Redo: Add Note”).
Sourcepub fn batch_execute(
&mut self,
cmds: Vec<Command>,
score: &mut Score,
) -> Result<(), Error>
pub fn batch_execute( &mut self, cmds: Vec<Command>, score: &mut Score, ) -> Result<(), Error>
Apply a batch of commands as a single undo entry (rollback-safe).
Sourcepub fn batch_execute_labeled(
&mut self,
cmds: Vec<Command>,
label: String,
score: &mut Score,
) -> Result<(), Error>
pub fn batch_execute_labeled( &mut self, cmds: Vec<Command>, label: String, score: &mut Score, ) -> Result<(), Error>
Apply a batch with an explicit undo-label, as a single rollback-safe entry.
The label appears as the command_key for undo/redo UI (e.g. "ApplyAI").
Auto Trait Implementations§
impl Freeze for CommandStack
impl RefUnwindSafe for CommandStack
impl Send for CommandStack
impl Sync for CommandStack
impl Unpin for CommandStack
impl UnsafeUnpin for CommandStack
impl UnwindSafe for CommandStack
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