Crate swimos_encoding

Source
Expand description

§Utilities for building Tokio encoders and decoders

Provides types and functions to use to implement tokio_util::codec::Encoders and tokio_util::codec::Decoders.

Structs§

BytesStr
A string based on a sub-range within a Bytes buffer. The bytes are guaranteed to contain valid UTF-8. The purpose of this type is to allow a tokio_util::codec::Decoders to return a string from its input buffer without performing a copy or an allocation and without a lifetime dependency on the buffer.
WithLengthBytesCodec
Codec that will encode the length of an array of bytes, as a 64bit unsigned integer, followed by its contents.

Traits§

TryFromUtf8Bytes
Trait for types that can be created from a buffer that potentially contains UTF-8. This duplicates the standard library TryFrom but allows us to implement it for types we do not control.

Functions§

consume_bounded
Feed a bounded number of bytes into a Decoder. If the input buffer contains more bytes than the limit, the decoder is passed the limited prefix and Decoder::decode_eof is called, rather than Decoder::decode. This is useful when Decoders are composed and some subset of the input of one encoder is delegated to another.