Skip to main content

LexBuffer

Struct LexBuffer 

Source
pub struct LexBuffer { /* private fields */ }
Expand description

Placeholder for LexBuffer from lua_vm::zio. TODO(port): replace with use lua_vm::zio::LexBuffer in Phase B. types.tsv: Mbuffer → LexBuffer

Implementations§

Source§

impl LexBuffer

Source

pub fn new() -> Self

Source

pub fn len(&self) -> usize

macros.tsv: luaZ_bufflen → buf.len()

Source

pub fn capacity(&self) -> usize

macros.tsv: luaZ_sizebuffer → buf.capacity()

Source

pub fn as_slice(&self) -> &[u8]

macros.tsv: luaZ_buffer → buf.as_mut_slice()

Source

pub fn clear(&mut self)

macros.tsv: luaZ_resetbuffer → buf.clear()

Source

pub fn truncate_by(&mut self, i: usize)

macros.tsv: luaZ_buffremove → buf.truncate_by(i)

Source

pub fn resize( &mut self, _state: &mut LuaState, size: usize, ) -> Result<(), LuaError>

allocated capacity. In C this changes buffsize, not the live byte count n. The Rust analogue therefore manipulates Vec::capacity, never Vec::len (otherwise push_byte would write past the live content and leave embedded zero padding inside the token text).

Trait Implementations§

Source§

impl Default for LexBuffer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.