pub struct UndoStack { /* private fields */ }Expand description
Bounded undo and redo history of editor snapshots, where any new step clears the redo side.
Implementations§
Source§impl UndoStack
impl UndoStack
Sourcepub fn new(limit: usize) -> Self
pub fn new(limit: usize) -> Self
An empty history keeping at most limit undo steps, 0 keeps none.
Sourcepub fn set_limit(&mut self, limit: usize)
pub fn set_limit(&mut self, limit: usize)
Change the limit, dropping the oldest steps beyond it.
Sourcepub fn record(&mut self, before: Snapshot)
pub fn record(&mut self, before: Snapshot)
Record the state before an edit and clear the redo side.
Sourcepub fn undo(&mut self, current: Snapshot) -> Option<Snapshot>
pub fn undo(&mut self, current: Snapshot) -> Option<Snapshot>
Step back: returns the state to restore and keeps current for redo.
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