pub struct StreamState<T> { /* private fields */ }Expand description
Guest-side driver for an arena-style cdylib stream (FIDIUS-T-0138). Wraps the
producer Stream<T> and holds the current
item value (not its bytes), so a BUFFER_TOO_SMALL retry re-serializes the
same item rather than advancing the iterator (which would drop it) — and so
the happy path serializes directly into the host buffer with no Vec
allocation.
Implementations§
Source§impl<T> StreamState<T>where
T: Serialize,
impl<T> StreamState<T>where
T: Serialize,
Sourcepub fn new(stream: Stream<T>) -> StreamState<T>
pub fn new(stream: Stream<T>) -> StreamState<T>
Wrap a producer stream.
Sourcepub fn next_into(&mut self, buf: &mut [u8]) -> NextStatus
pub fn next_into(&mut self, buf: &mut [u8]) -> NextStatus
Pull the next item (if needed) and serialize it directly into buf —
no intermediate allocation. On TooSmall the item value is retained and
re-serialized on the next (larger-buffer) call, so nothing is lost.
Auto Trait Implementations§
impl<T> !RefUnwindSafe for StreamState<T>
impl<T> !Sync for StreamState<T>
impl<T> !UnwindSafe for StreamState<T>
impl<T> Freeze for StreamState<T>where
T: Freeze,
impl<T> Send for StreamState<T>where
T: Send,
impl<T> Unpin for StreamState<T>where
T: Unpin,
impl<T> UnsafeUnpin for StreamState<T>where
T: UnsafeUnpin,
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