Expand description
Variable length octet sequences.
This crate provides a set of basic traits that allow defining types that are generic over a variable length sequence of octets (or, vulgo: bytes).
There are two groups of traits: those that represent behavior of immutable octets sequences are collected in the module octets and those for building such sequences are in builder. Most traits from these modules are also re-exported at the crate root for convenience.
These traits are implemented for a number of types. Apart from [u8]
,
the implementations are opt-in via features. These are:
std
forVec<u8>
,Cow<[u8]>
, andArc<[u8]>
,bytes
for theBytes
andBytesMut
types from the bytes crate,heapless
for theVec<u8, N>
type from the heapless crate, andsmallvec
for a smallvec for item typeu8
from the smallvec crate.
A number of additional modules exist that provide a few helpful things:
- The array module provides an octets builder backed by an octets array.
- The str module provides both immutable and buildable string types that are generic over the octets sequence they wrap.
- The
serde
module, which needs to be enabled via the
serde
feature, provides traits and functions to more efficiently serialize octets sequences.
Re-exports§
pub use self::array::Array;
pub use self::builder::EmptyBuilder;
pub use self::builder::FreezeBuilder;
pub use self::builder::FromBuilder;
pub use self::builder::IntoBuilder;
pub use self::builder::OctetsBuilder;
pub use self::builder::ShortBuf;
pub use self::builder::Truncate;
pub use self::octets::Octets;
pub use self::octets::OctetsFrom;
pub use self::octets::OctetsInto;
pub use self::parse::Parser;
pub use self::parse::ShortInput;
pub use self::str::Str;
pub use self::str::StrBuilder;
Modules§
- A fixed-capacity octets sequence.
- Octets Builders
- Octets Sequences
- Reading data from an octet sequence.
- Strings atop octet sequences.