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§
- Bytes
Str - A string based on a sub-range within a
Bytesbuffer. The bytes are guaranteed to contain valid UTF-8. The purpose of this type is to allow atokio_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. - With
Length Bytes Codec - Codec that will encode the length of an array of bytes, as a 64bit unsigned integer, followed by its contents.
Traits§
- TryFrom
Utf8 Bytes - Trait for types that can be created from a buffer that potentially contains UTF-8. This duplicates
the standard library
TryFrombut 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 andDecoder::decode_eofis called, rather thanDecoder::decode. This is useful whenDecoders are composed and some subset of the input of one encoder is delegated to another.