Skip to main content

ChunkReader

Type Alias ChunkReader 

Source
pub type ChunkReader = Box<dyn FnMut(&mut LuaState) -> Result<Option<Vec<u8>>, LuaError>>;
Expand description

Reentrant chunk supplier for a ZIO.

Mirrors C’s lua_Reader: the reader is invoked with the live lua_State each time more bytes are needed, so a load reader written in Lua can call back into the interpreter mid-parse. Ok(None) signals end-of-stream; an Err aborts the parse with that error (the C reader equivalent is a longjmp). Bytes are owned (Vec<u8>) rather than borrowed because a dyn trait object cannot name the reader’s internal-buffer lifetime.

Aliased Type§

pub struct ChunkReader(/* private fields */);