Skip to main content

ZIO

Struct ZIO 

Source
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 *L is removed from the struct; callers hold &mut LuaState directly and pass it to fallible methods (per types.tsv).
  • void *data is folded into the reader closure (per types.tsv).
  • const char *p (raw pointer into the reader’s internal buffer) becomes a usize index into the owned current_chunk field.

§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 methods

PORT 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> 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.