Module octseq::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§

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

Traits§

  • An octets builder that can be newly created empty.
  • An octets builder that can be frozen into a imutable octets sequence.
  • An octets type that can be created from an octets builder.
  • An octets type that can be converted into an octets builder.
  • A buffer to construct an octet sequence.
  • An octet sequence that can be shortened.

Functions§

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

Type Aliases§

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