pub struct AirbenderCodecV0;Expand description
Initial codec based on bincode v2 with a fixed configuration.
Implementations§
Source§impl AirbenderCodecV0
impl AirbenderCodecV0
Sourcepub fn decode_from_reader<T, R>(reader: &mut R) -> Result<T, CodecError>where
T: DeserializeOwned,
R: FramedRead,
pub fn decode_from_reader<T, R>(reader: &mut R) -> Result<T, CodecError>where
T: DeserializeOwned,
R: FramedRead,
Decode a value from a streaming FramedRead source using the same
configuration as AirbenderCodec::decode.
Unlike the slice-based decode, the end-of-input check is left to the
caller: a reader knows the frame bounds, bincode does not. Callers that
need the codec’s trailing-byte strictness should verify the reader is
fully consumed and raise CodecError::TrailingBytes themselves (see
airbender_core::wire::FramedReader::remaining).
For DeserializeOwned types this consumes exactly the same bytes with
the same validation as decode. One failure-mode difference: a
deserialize_bytes visitor (e.g. serde_bytes) is served zero-copy by
the slice path but goes through Vec<u8>::decode here, which allocates
the claimed length up front — so a bogus inner length fails as an
allocation abort rather than a clean DecodeError. Ordinary Vec<u8>
and String fields are unaffected (both paths allocate up front).