Struct undo::record::Queue

source ·
pub struct Queue<'a, E, 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.edit(Add('a'));
queue.edit(Add('b'));
queue.edit(Add('c'));
assert_eq!(string, "");

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

Implementations§

source§

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

source

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

Returns a queue.

source

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

Returns a checkpoint.

source

pub fn edit(&mut self, edit: E)

Queues a Record::edit call.

source

pub fn undo(&mut self)

Queues a Record::undo call.

source

pub fn redo(&mut self)

Queues a Record::redo call.

source

pub fn cancel(self)

Cancels the queued edits.

source§

impl<E: Edit, S: Slot> Queue<'_, E, S>

source

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

Applies the queued edits.

Trait Implementations§

source§

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

source§

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

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

impl<'a, E, S> From<&'a mut Record<E, S>> for Queue<'a, E, S>

source§

fn from(record: &'a mut Record<E, S>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a, E, S> !UnwindSafe for Queue<'a, E, 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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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.
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.
source§

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

Performs the conversion.