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.
C: Mbuffer — growable byte buffer for token text.
types.tsv: Mbuffer → LexBuffer
Implementations§
Source§impl LexBuffer
impl LexBuffer
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
C: #define luaZ_bufflen(b) ((b)->n) — live byte count.
macros.tsv: luaZ_bufflen → buf.len()
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
C: #define luaZ_sizebuffer(b) ((b)->buffsize) — allocated capacity.
macros.tsv: luaZ_sizebuffer → buf.capacity()
Sourcepub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_slice(&self) -> &[u8] ⓘ
C: #define luaZ_buffer(b) ((b)->buffer) — raw byte slice.
macros.tsv: luaZ_buffer → buf.as_mut_slice()
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
C: #define luaZ_resetbuffer(b) ((b)->n = 0) — reset to zero length.
macros.tsv: luaZ_resetbuffer → buf.clear()
Sourcepub fn truncate_by(&mut self, i: usize)
pub fn truncate_by(&mut self, i: usize)
C: #define luaZ_buffremove(b, i) ((b)->n -= (i)).
macros.tsv: luaZ_buffremove → buf.truncate_by(i)
Sourcepub fn resize(
&mut self,
_state: &mut LuaState,
size: usize,
) -> Result<(), LuaError>
pub fn resize( &mut self, _state: &mut LuaState, size: usize, ) -> Result<(), LuaError>
C: luaZ_resizebuffer(L, b, newsize) — grow/shrink the buffer’s
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).