pub struct Data { /* private fields */ }Implementations§
source§impl Data
impl Data
pub fn new(bytes: Vec<u8>, history_limit: usize) -> Self
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§
source§impl UserData for Data
impl UserData for Data
source§fn add_fields<'lua, F: UserDataFields<'lua, Self>>(fields: &mut F)
fn add_fields<'lua, F: UserDataFields<'lua, Self>>(fields: &mut F)
Adds custom fields specific to this userdata.
source§fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M)
Adds custom methods and operators specific to this userdata.
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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 moresource§impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
impl<'lua, T> IntoLuaMulti<'lua> for Twhere
T: IntoLua<'lua>,
source§fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
fn into_lua_multi(self, lua: &'lua Lua) -> Result<MultiValue<'lua>, Error>
Performs the conversion.