Struct 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 reserve(&mut self, additional: usize)

Reserves capacity for at least additional more entries in the queue.

§Panics

Panics if the new capacity exceeds isize::MAX bytes.

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> Freeze for Queue<'a, E, S>

§

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

§

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

§

impl<'a, E, S> Sync for Queue<'a, E, S>
where S: Sync, E: 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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.