pub struct History<I: HistoryItem> { /* private fields */ }Expand description
The History is used to keep track of changes to a model and to allow undo and redo operations.
This is now used in Input for undo/redo operations. You can also use this in your own models to keep track of changes, for example to track the tab history for prev/next features.
§Use cases
- Undo/redo operations in Input
- Tracking tab history for prev/next features
Implementations§
Source§impl<I> History<I>where
I: HistoryItem,
impl<I> History<I>where
I: HistoryItem,
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 steps to keep, defaults to 1000.
Sourcepub fn unique(self) -> Self
pub fn unique(self) -> Self
Set the history to be unique, defaults to false. If set to true, the history will only keep unique changes.
Sourcepub fn group_interval(self, group_interval: Duration) -> Self
pub fn group_interval(self, group_interval: Duration) -> Self
Set the interval in milliseconds to group changes, defaults to None.
Sourcepub fn start_grouping(&mut self)
pub fn start_grouping(&mut self)
Start grouping changes, this will prevent the version from being incremented until end_grouping is called.
Sourcepub fn end_grouping(&mut self)
pub fn end_grouping(&mut self)
End grouping changes, this will allow the version to be incremented again.
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for History<I>
impl<I> RefUnwindSafe for History<I>where
I: RefUnwindSafe,
impl<I> Send for History<I>where
I: Send,
impl<I> Sync for History<I>where
I: Sync,
impl<I> Unpin for History<I>where
I: Unpin,
impl<I> UnwindSafe for History<I>where
I: UnwindSafe,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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