Module builder

Source
Expand description

Octets Builders

Octets builders, i.e., anything that implements the OctetsBuilder trait, represent a buffer to which octets can be appended. Whether the buffer can grow to accommodate appended data depends on the underlying type.

The OctetsBuilder trait only provides methods to append data to the builder. Implementations may, however, provide more functionality. They do so by implementing additional traits. Conversely, if additional functionality is needed from a builder, this can be expressed by adding trait bounds.

Some examples are:

  • creating an empty octets builder from scratch is provided by the EmptyBuilder trait,
  • looking at already assembled octets is done via AsRef<[u8]>,
  • manipulation of already assembled octets requires AsMut<[u8]>, and
  • truncating the sequence of assembled octets happens through Truncate.

Structs§

ShortBuf
An attempt was made to write beyond the end of a buffer.

Traits§

EmptyBuilder
An octets builder that can be newly created empty.
FreezeBuilder
An octets builder that can be frozen into a immutable octets sequence.
FromBuilder
An octets type that can be created from an octets builder.
IntoBuilder
An octets type that can be converted into an octets builder.
OctetsBuilder
A buffer to construct an octet sequence.
Truncate
An octet sequence that can be shortened.

Functions§

infallible
Erases an error for infallible results.
with_infallible
Erases an error for a closure returning an infallible results.

Type Aliases§

BuilderAppendError
A type alias resolving into the AppendError of an octets type’s builder.