pub struct UndoHistory { /* private fields */ }Expand description
One field’s undo history: what it was, and what it was about to be.
Implementations§
Source§impl UndoHistory
impl UndoHistory
Sourcepub fn record(&mut self, before: EditSnapshot, kind: EditKind, since: f32)
pub fn record(&mut self, before: EditSnapshot, kind: EditKind, since: f32)
Records that the field, which was before, has just been changed by a change
of kind kind, since seconds after the last one.
A change that joins the run in progress records nothing: the run’s first entry already holds the state the whole run will be undone to.
Sourcepub fn close_run(&mut self)
pub fn close_run(&mut self)
Ends the run in progress without recording anything: the caret moved, so what is typed next is a step of its own.
Sourcepub fn undo(&mut self, current: EditSnapshot) -> Option<EditSnapshot>
pub fn undo(&mut self, current: EditSnapshot) -> Option<EditSnapshot>
Steps back: current is where the field is now, and the answer is where it should
go. None when there is nothing to undo.
Sourcepub fn redo(&mut self, current: EditSnapshot) -> Option<EditSnapshot>
pub fn redo(&mut self, current: EditSnapshot) -> Option<EditSnapshot>
Steps forward again, undoing an undo. None when nothing was undone.
Trait Implementations§
Source§impl Clone for UndoHistory
impl Clone for UndoHistory
Source§impl Debug for UndoHistory
impl Debug for UndoHistory
Source§impl Default for UndoHistory
impl Default for UndoHistory
impl Eq for UndoHistory
Source§impl PartialEq for UndoHistory
impl PartialEq for UndoHistory
impl StructuralPartialEq for UndoHistory
Auto Trait Implementations§
impl Freeze for UndoHistory
impl RefUnwindSafe for UndoHistory
impl Send for UndoHistory
impl Sync for UndoHistory
impl Unpin for UndoHistory
impl UnsafeUnpin for UndoHistory
impl UnwindSafe for UndoHistory
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