pub struct ZIO { /* private fields */ }Expand description
Buffered input stream wrapping an external chunk-reader callback.
Corresponds to struct Zio / ZIO in lzio.h. The C struct stored a
lua_State *L back-pointer and a void *data opaque pointer alongside a
raw lua_Reader function pointer. In Rust:
lua_State *Lis removed from the struct; callers hold&mut LuaStatedirectly and pass it to fallible methods (per types.tsv).void *datais folded into the reader closure (per types.tsv).const char *p(raw pointer into the reader’s internal buffer) becomes ausizeindex into the ownedcurrent_chunkfield.
§C mapping (types.tsv)
Zio → ZIO
.n → usize (bytes still unread in current_chunk)
.p → usize (cursor index; was const char *)
.reader+.data → Box<dyn FnMut() -> Option<Vec<u8>>> (combined)
.L → removed; callers pass &mut LuaState to methodsPORT NOTE: The types.tsv entry for Zio.reader lists
Box<dyn FnMut() -> Option<&[u8]>>, but &[u8] cannot name a lifetime
in a dyn Fn trait object without HRTB and a pinned source. Phase A uses
Option<Vec<u8>> instead; the reader returns an owned chunk. Phase B
should evaluate whether a zero-copy &[u8] path is achievable (e.g. by
making the reader hold a pinned internal buffer and returning a slice into
it via HRTB).
Auto Trait Implementations§
impl Freeze for ZIO
impl !RefUnwindSafe for ZIO
impl !Send for ZIO
impl !Sync for ZIO
impl Unpin for ZIO
impl UnsafeUnpin for ZIO
impl !UnwindSafe for ZIO
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