[−][src]Struct undo::Queue
A command queue wrapper.
Wraps a record or history and gives it batch queue functionality. This allows the record or history to queue up commands and either cancel or apply them later.
Examples
let mut record = Record::default(); let mut queue = record.queue(); queue.apply(Add('a')); queue.apply(Add('b')); queue.apply(Add('c')); assert_eq!(queue.target(), ""); queue.commit()?; assert_eq!(record.target(), "abc");
Implementations
impl<'a, T> Queue<'a, T>
[src]
pub fn apply(&mut self, command: impl Command<T>)
[src]
Queues an apply
action.
pub fn undo(&mut self)
[src]
Queues an undo
action.
pub fn redo(&mut self)
[src]
Queues a redo
action.
pub fn commit(self) -> Result
[src]
Applies the actions that is queued.
Errors
If an error occurs, it stops applying the actions and returns the error.
pub fn cancel(self)
[src]
Cancels the queued actions.
pub fn queue(&mut self) -> Queue<'_, T>
[src]
Returns a queue.
pub fn checkpoint(&mut self) -> Checkpoint<'_, T>
[src]
Returns a checkpoint.
pub fn target(&self) -> &T
[src]
Returns a reference to the target
.
Trait Implementations
impl<'a, T: Debug + 'static> Debug for Queue<'a, T>
[src]
impl<'a, T> From<&'a mut Record<T>> for Queue<'a, T>
[src]
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Queue<'a, T>
impl<'a, T> !Send for Queue<'a, T>
impl<'a, T> !Sync for Queue<'a, T>
impl<'a, T> Unpin for Queue<'a, T>
impl<'a, T> !UnwindSafe for Queue<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,