Available on crate feature
std only.Expand description
std::io::Read / std::io::Write integration: the streaming Tier-2
encoder and decoder pair, plus convenience free functions.
This module is gated on the std feature (on by default). With std off,
the crate compiles for no_std targets using core + alloc only and
none of this module is reachable.
§When to use which entry point
- For one-shot send / receive of a single value, prefer
encode_into/decode_from: they take anyWrite/Readand handle the buffering. - For interleaved writes / reads across many values without per-value
allocation, instantiate an
IoEncoder/IoDecoderand callwrite/readrepeatedly.
§Errors
Both directions surface I/O failure through the codec’s
crate::SerialError type via SerialError::Io. The Io variant
captures std::io::ErrorKind and a message string — enough to surface
the original cause without taking on a non-Clone payload.
Structs§
- IoDecoder
- Streaming decoder that reads directly from any
Read-shaped source. - IoEncoder
- Streaming encoder that writes directly into any
Write-shaped sink.
Functions§
- decode_
from - Read all remaining bytes from
readerand decode them as a single value of typeT. - encode_
into - Encode
valueand write the result intowriterin a single call.