pub fn read_with<T>(transport: &mut impl Transport) -> Result<T, GuestError>where
T: DeserializeOwned,Expand description
Read a single value using an explicit transport.
Decodes straight from the framed word transport without first buffering the
serialized blob into a Vec<u8>, so peak memory is the decoded value alone
(~1x) rather than blob-plus-value (~2x).
For any input the buffered path could allocate, the accept/reject set is
identical: same bincode config, and a value that does not consume the whole
frame is still a CodecError::TrailingBytes. Streaming additionally
succeeds on inputs so large the buffered path’s up-front Vec::with_capacity
would fail — which is the point of the change.
Like the buffered path, the whole frame is consumed from transport whether
the decode succeeds or fails, so a subsequent read_with stays aligned.