pub struct History {
pub undo_stack: Vec<Transaction>,
pub redo_stack: Vec<Transaction>,
}Expand description
Tracks the undo and redo history of a document.
Transactions are stored in the undo stack when they are applied. When a transaction is undone, it is moved to the redo stack. When it is redone, it is moved back to the undo stack.
The most recent transaction is stored at the end of each stack.
Adding a new edit after undoing previous edits should clear the redo stack, as the previous redo history is no longer applicable.
Fields§
§undo_stack: Vec<Transaction>Transactions that can currently be undone.
The most recent transaction is at the end of the vector.
redo_stack: Vec<Transaction>Transactions that can currently be redone.
The most recently undone transaction is at the end of the vector.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
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