pub struct Simple<T, R, Undo: FnOnce(T) -> R> { /* private fields */ }Expand description
Carries a value with an undo action
Trait Implementations§
Source§impl<T, R, Undo: FnOnce(T) -> R> Atom for Simple<T, R, Undo>
impl<T, R, Undo: FnOnce(T) -> R> Atom for Simple<T, R, Undo>
Source§fn undo(self) -> Self::Undo
fn undo(self) -> Self::Undo
Returns the result of the undo function
let v = rewind::simple(4, |v| v + 2);
assert_eq!(v.undo(), 6);Source§fn decay(self) -> Self::Decay
fn decay(self) -> Self::Decay
Returns the original value
let v = rewind::simple(4, |v| v + 2);
assert_eq!(v.decay(), 4);type Undo = R
type Decay = T
Auto Trait Implementations§
impl<T, R, Undo> Freeze for Simple<T, R, Undo>
impl<T, R, Undo> RefUnwindSafe for Simple<T, R, Undo>where
T: RefUnwindSafe,
Undo: RefUnwindSafe,
impl<T, R, Undo> Send for Simple<T, R, Undo>
impl<T, R, Undo> Sync for Simple<T, R, Undo>
impl<T, R, Undo> Unpin for Simple<T, R, Undo>
impl<T, R, Undo> UnwindSafe for Simple<T, R, Undo>where
T: UnwindSafe,
Undo: 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