pub struct Data { /* private fields */ }Implementations§
Source§impl Data
impl Data
pub fn new(bytes: Vec<u8>, history_limit: usize) -> Self
pub fn get(&self, i: usize) -> Option<u8>
pub fn set(&mut self, i: usize, byte: u8) -> Result<(), Error>
pub fn bytes(&self) -> &[u8] ⓘ
pub fn dirty(&self) -> bool
pub fn reset_dirty(&mut self)
Sourcepub fn push_change(&mut self, offset: usize, new: Vec<u8>) -> usize
pub fn push_change(&mut self, offset: usize, new: Vec<u8>) -> usize
Pushes a change to the history and updates the data. Returns the number of bytes changed. Panics if the offset is out of bounds.
Sourcepub fn undo(&mut self) -> Option<&Change>
pub fn undo(&mut self) -> Option<&Change>
Undo the last change. Returns the change that was undone, if any.
Sourcepub fn redo(&mut self) -> Option<&Change>
pub fn redo(&mut self) -> Option<&Change>
Redo the last change. Returns the change that was redone, if any.
pub fn clear_history(&mut self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more