Module octets

Source
Expand description

Octets Sequences

An octets sequence – or just octets for short – is a variable length sequence of bytes. In their most simple form, any type that implements AsRef<[u8]> can serve as octets. However, in some cases additional functionality is required.

The trait Octets allows taking a sub-sequence, called a ‘range’, out of the octets in the cheapest way possible. For most types, ranges will be octet slices &[u8] but some shareable types (most notably bytes::Bytes) allow ranges to be owned values, thus avoiding the lifetime limitations a slice would bring. Therefore, Octets allows defining the type of a range as an associated type.

Traits§

Octets
A type representing an octets sequence.
OctetsFrom
Convert a type from one octets type to another.
OctetsInto
Convert a type from one octets type to another.

Type Aliases§

SmallOctets
A octets vector that doesn’t allocate for small sizes.