pub struct UndoHistory<T> { /* private fields */ }Expand description
A history of grouped undo transactions.
Implementations§
Source§impl<T> UndoHistory<T>
impl<T> UndoHistory<T>
pub fn new() -> Self
Sourcepub fn max_undos(self, max_undos: usize) -> Self
pub fn max_undos(self, max_undos: usize) -> Self
Set the maximum number of undo transactions to keep, defaults to 1000.
Lowering the limit immediately removes the oldest undo transactions.
Sourcepub fn group_interval(self, group_interval: Duration) -> Self
pub fn group_interval(self, group_interval: Duration) -> Self
Set the interval in which consecutive changes are grouped.
A successful undo or redo ends timed grouping. Explicit grouping is independent and can still append to the current transaction.
Sourcepub fn start_grouping(&mut self)
pub fn start_grouping(&mut self)
Start explicitly grouping pushed changes into one transaction.
Sourcepub fn end_grouping(&mut self)
pub fn end_grouping(&mut self)
End explicit grouping of pushed changes.
Sourcepub fn is_ignoring(&self) -> bool
pub fn is_ignoring(&self) -> bool
Returns whether history recording is currently ignored.
Sourcepub fn set_ignoring(&mut self, ignoring: bool)
pub fn set_ignoring(&mut self, ignoring: bool)
Sets whether history recording is currently ignored.
Sourcepub fn push(&mut self, item: T)
pub fn push(&mut self, item: T)
Pushes a change into the current transaction or starts a new one.
Sourcepub fn undo(&mut self) -> Option<Vec<T>>where
T: Clone,
pub fn undo(&mut self) -> Option<Vec<T>>where
T: Clone,
Undoes the latest transaction, returning changes newest first.
Trait Implementations§
Source§impl<T: Debug> Debug for UndoHistory<T>
impl<T: Debug> Debug for UndoHistory<T>
Auto Trait Implementations§
impl<T> Freeze for UndoHistory<T>
impl<T> RefUnwindSafe for UndoHistory<T>
impl<T> Send for UndoHistory<T>
impl<T> Sync for UndoHistory<T>
impl<T> Unpin for UndoHistory<T>
impl<T> UnsafeUnpin for UndoHistory<T>
impl<T> UnwindSafe for UndoHistory<T>
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<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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().