[][src]Struct byte_mutator::undo_buffer::UndoBuffer

pub struct UndoBuffer { /* fields omitted */ }

Fixed size buffer with an original state and a writeable buffer. Tracks which region of the buffer has been exposed for changes and enables an undo of those changes.

Methods

impl UndoBuffer[src]

pub fn new(buf: &[u8]) -> Self[src]

pub fn len(&self) -> usize[src]

Used length of the writable buffer

pub fn is_empty(&self) -> bool[src]

Whether the writable buffer is empty

pub fn get_mut(&mut self) -> &mut [u8][src]

Returns a full mutable slice of the write buffer, and marks the entire thing as dirty.

pub fn get_mut_range(&mut self, start: usize, end: usize) -> &mut [u8][src]

Returns a mutable subslice of the buffer. Marks that region as dirty for future undo operations.

pub fn read(&self) -> &[u8][src]

Returns an immutable reference to the buffer in its current state

pub fn undo(&mut self)[src]

Undo all changes and set the write/readable buffer back to the original state

Trait Implementations

impl Clone for UndoBuffer[src]

impl Debug for UndoBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]