pub struct Undoer<State> { /* private fields */ }Expand description
Automatic undo system. Feed it the latest state every frame; it decides when to snapshot a new undo point.
Implementations§
Source§impl<State> Undoer<State>
impl<State> Undoer<State>
Sourcepub fn with_settings(settings: Settings) -> Self
pub fn with_settings(settings: Settings) -> Self
Sourcepub fn has_undo(&self, current_state: &State) -> bool
pub fn has_undo(&self, current_state: &State) -> bool
Do we have an undo point different from the given state?
Sourcepub fn has_redo(&self, current_state: &State) -> bool
pub fn has_redo(&self, current_state: &State) -> bool
Do we have a redo point available for the given state?
Sourcepub fn is_in_flux(&self) -> bool
pub fn is_in_flux(&self) -> bool
Is the state currently mid-change (a flux is being tracked)?
Sourcepub fn undo(&mut self, current_state: &State) -> Option<&State>
pub fn undo(&mut self, current_state: &State) -> Option<&State>
Undo one step, returning the state to revert to (if any).
Sourcepub fn redo(&mut self, current_state: &State) -> Option<&State>
pub fn redo(&mut self, current_state: &State) -> Option<&State>
Redo one step, returning the state to advance to (if any).
Sourcepub fn add_undo(&mut self, current_state: &State)
pub fn add_undo(&mut self, current_state: &State)
Add an undo point iff the state differs from the latest point.
Sourcepub fn feed_state(&mut self, current_time: f64, current_state: &State)
pub fn feed_state(&mut self, current_time: f64, current_state: &State)
Feed the most recent state (call every frame). current_time is in
seconds. Implements the two coalescing rules described on egui’s
Undoer.
Trait Implementations§
Auto Trait Implementations§
impl<State> Freeze for Undoer<State>where
State: Freeze,
impl<State> RefUnwindSafe for Undoer<State>where
State: RefUnwindSafe,
impl<State> Send for Undoer<State>where
State: Send,
impl<State> Sync for Undoer<State>where
State: Sync,
impl<State> Unpin for Undoer<State>where
State: Unpin,
impl<State> UnsafeUnpin for Undoer<State>where
State: UnsafeUnpin,
impl<State> UnwindSafe for Undoer<State>where
State: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
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
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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().