pub struct Buffer { /* private fields */ }Expand description
A Luau buffer type.
See the buffer documentation for more information.
Mirrors mlua::Buffer. Holds a registry reference keeping the buffer alive.
Under the send feature it is Send but never Sync — see
[crate::sync::NotSync].
Implementations§
Source§impl Buffer
impl Buffer
Sourcepub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn to_vec(&self) -> Vec<u8> ⓘ
Copies the buffer data into a new Vec<u8>.
Mirrors mlua::Buffer::to_vec.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the buffer is empty.
Mirrors mlua::Buffer::is_empty.
Sourcepub fn read_bytes<const N: usize>(&self, offset: usize) -> [u8; N]
pub fn read_bytes<const N: usize>(&self, offset: usize) -> [u8; N]
Reads given number of bytes from the buffer at the given offset.
Offset is 0-based.
Mirrors mlua::Buffer::read_bytes.
Sourcepub fn write_bytes(&self, offset: usize, bytes: &[u8])
pub fn write_bytes(&self, offset: usize, bytes: &[u8])
Writes given bytes to the buffer at the given offset.
Offset is 0-based.
Mirrors mlua::Buffer::write_bytes.
Trait Implementations§
Source§impl FromLua for Buffer
impl FromLua for Buffer
Source§fn from_lua_arg(
arg: Value,
_i: usize,
_to: Option<&str>,
lua: &Lua,
) -> Result<Self>
fn from_lua_arg( arg: Value, _i: usize, _to: Option<&str>, lua: &Lua, ) -> Result<Self>
Convert an argument at 1-based position
i. The default forwards to
FromLua::from_lua; specific impls can produce nicer messages.
Mirrors mlua::FromLua::from_lua_arg.Auto Trait Implementations§
impl !RefUnwindSafe for Buffer
impl !Send for Buffer
impl !Sync for Buffer
impl !UnwindSafe for Buffer
impl Freeze for Buffer
impl Unpin for Buffer
impl UnsafeUnpin for Buffer
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> FromLuaMulti for Twhere
T: FromLua,
impl<T> FromLuaMulti for Twhere
T: FromLua,
Source§fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
Perform the conversion.
Source§impl<T> IntoLuaMulti for Twhere
T: IntoLua,
impl<T> IntoLuaMulti for Twhere
T: IntoLua,
Source§fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
Perform the conversion.