Expand description
§Push-based decoding
This crate provides abstractions for push-based decoding and pull-based encoding. That means, the caller is responsible for obtaining the bytes to decode and feeding them into decoder or pulling bytes from encoder and feeding them into writr.
The main advantage of this approach is that it’s IO-agnostic, which implies both
async
-agnostic and no_std
. You can use the same code to deserialize from sync
and async
readers and only need a tiny piece of code to connect the reader to a decoder. This
piece of code is provided by this crate for std
, lgio
(usable with no_std
), tokio
, futures
and async-std
.
§Features
std
- enables integration with the standard library - it’s IO and error traitsalloc
- enables integration with the standardalloc
cratelgio
- connects decoders to lgio IO.tokio
- connects decoders to Tokio IO.async-std
- connects decoders to async-std IO.futures_0_3
- connects decoders to futures 0.3.x IO
Modules§
- decoders
- encoders
- error
- future
tokio
orasync-std
orfutures_0_3
- int
- Tools for decoding and encoding integers.
Macros§
Structs§
- Assume
Buffered - Wrapper for external types that are known to be buffered.
- Encoder
Position Tracker - An
Encoder
wrapper that handles partial writes.
Enums§
- Read
Error - Returned when either reading or decoding fails.
Traits§
- BufWrite
std
ortokio
orasync-std
orfutures_0_3
- Marker trait for writers that are either buffered or don’t incur the cost of context switch.
- Decoder
- Represents types responsible for decoding bytes pushed into it.
- Encoder
- Represents types producing bytes of some encoded value.
Functions§
- decode_
async_ std async-std
- Asynchronously decodes a value from the given reader.
- decode_
async_ std_ with async-std
- Asynchronously decodes a value from the given reader using a custom decoder.
- decode_
futures_ 0_ 3 futures_0_3
- Asynchronously decodes a value from the given reader.
- decode_
futures_ 0_ 3_ with futures_0_3
- Asynchronously decodes a value from the given reader using a custom decoder.
- decode_
sync std
- Synchronously decodes a value from the given reader.
- decode_
sync_ lgio lgio
- Synchronously decodes a value from the given reader.
- decode_
sync_ lgio_ with lgio
- Synchronously decodes a value from the given reader using a custom decoder.
- decode_
sync_ with std
- Synchronously decodes a value from the given reader using a custom decoder.
- decode_
tokio tokio
- Asynchronously decodes a value from the given reader.
- decode_
tokio_ with tokio
- Asynchronously decodes a value from the given reader using a custom decoder.