Struct undo::history::Queue

source ·
pub struct Queue<'a, A, S> { /* private fields */ }
Expand description

Wraps a record and gives it batch queue functionality.

Examples

let mut string = String::new();
let mut record = Record::new();
let mut queue = record.queue();

queue.apply(Push('a'));
queue.apply(Push('b'));
queue.apply(Push('c'));
assert_eq!(string, "");

queue.commit(&mut string);
assert_eq!(string, "abc");

Implementations§

source§

impl<A, S> Queue<'_, A, S>

source

pub fn queue(&mut self) -> Queue<'_, A, S>

Returns a queue.

source

pub fn checkpoint(&mut self) -> Checkpoint<'_, A, S>

Returns a checkpoint.

source§

impl<A: Action, S: Slot> Queue<'_, A, S>

source

pub fn apply(&mut self, action: A)

Queues an apply action.

source

pub fn undo(&mut self)

Queues an undo action.

source

pub fn redo(&mut self)

Queues a redo action.

source

pub fn commit(self, target: &mut A::Target) -> Vec<A::Output>

Applies the queued actions.

source

pub fn cancel(self)

Cancels the queued actions.

Trait Implementations§

source§

impl<'a, A: Debug, S: Debug> Debug for Queue<'a, A, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a, A, S> From<&'a mut History<A, S>> for Queue<'a, A, S>

source§

fn from(history: &'a mut History<A, S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a, A, S> RefUnwindSafe for Queue<'a, A, S>where A: RefUnwindSafe, S: RefUnwindSafe,

§

impl<'a, A, S> Send for Queue<'a, A, S>where A: Send, S: Send,

§

impl<'a, A, S> Sync for Queue<'a, A, S>where A: Sync, S: Sync,

§

impl<'a, A, S> Unpin for Queue<'a, A, S>where A: Unpin,

§

impl<'a, A, S> !UnwindSafe for Queue<'a, A, S>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.