Expand description
§Utilities for building Tokio encoders and decoders
Provides types and functions to use to implement tokio_util::codec::Encoder
s and
tokio_util::codec::Decoder
s.
Structs§
- Bytes
Str - 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 atokio_util::codec::Decoder
s 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
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 andDecoder::decode_eof
is called, rather thanDecoder::decode
. This is useful whenDecoder
s are composed and some subset of the input of one encoder is delegated to another.