This crate provides the utilities needed to easily implement a Tokio transport using serde for serialization and deserialization of frame values.
This crate provides transport combinators that transform a stream of frames encoded as bytes into a stream of frame values. It is expected that the framing happens at another layer. One option is to use a length delimited framing transport.
The crate provides two traits that must be implemented:
Deserializer. Implementations of these traits are then passed to
Framed along with the upstream
Sink that handles the byte encoded frames.
By doing this, a transformation pipeline is built. For reading, it looks something like this:
The write half looks like:
For an example, see how JSON support is implemented:
Adapts a transport to a value sink by serializing the values and to a stream of values by deserializing them.
Deserializes a value from a source buffer
Serializes a value into a destination buffer