pub struct UndoStack { /* private fields */ }Expand description
Standard undo/redo stack with bounded depth.
Lives on the Player struct — single-threaded, only the player command loop touches it. New actions clear the redo stack (standard semantics).
Uses VecDeque so evicting the oldest entry (front) is O(1) instead of
the O(n) Vec::remove(0).
Implementations§
Source§impl UndoStack
impl UndoStack
pub fn new() -> Self
Sourcepub fn push(&mut self, entry: UndoEntry)
pub fn push(&mut self, entry: UndoEntry)
Push an undo entry. Clears the redo stack.
Batch entries exceeding MAX_BATCH_SIZE are truncated.
Sourcepub fn pop_redo(&mut self) -> Option<UndoEntry>
pub fn pop_redo(&mut self) -> Option<UndoEntry>
Pop the most recent redo entry (for Ctrl+Y / Ctrl+Shift+Z).
Sourcepub fn push_redo(&mut self, entry: UndoEntry)
pub fn push_redo(&mut self, entry: UndoEntry)
Push an entry onto the redo stack (called when undoing).
Sourcepub fn push_undo_keep_redo(&mut self, entry: UndoEntry)
pub fn push_undo_keep_redo(&mut self, entry: UndoEntry)
Push an entry onto the undo stack without clearing redo (called when redoing).
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
pub fn undo_len(&self) -> usize
pub fn redo_len(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UndoStack
impl RefUnwindSafe for UndoStack
impl Send for UndoStack
impl Sync for UndoStack
impl Unpin for UndoStack
impl UnsafeUnpin for UndoStack
impl UnwindSafe for UndoStack
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more