Crate atlv

Source
Expand description

Encode and decode atlv values.

Algebraic Tag Length Value (atlv) is a binary data encoding designed for extensibility, generality, and compactness. Each value has a flexible-length tag, and may be one of four Kinds, two simple and two recursive:

  • Quantities encode enumerable values, using Variable Length Quantities.
  • Binaries encode sequences of bytes.
  • Unions encapsulate a single value.
  • Arrays encapsulate a sequence of values.

This crate provides a trait to encode and decode rust values directly into atlv streams, and a type to model and genericly encode and decode arbitrary atlv values. Use the trait unless you need to manipulate or examine unstructured atlv values.

Modules§

vlq
This module rexports the relevant pieces vlq_bij relevant to atlv.

Structs§

DecArray
A decoding atlv stream in the process of decoding an array of values.
DecBinary
A decoding atlv stream in the process of decoding a binary value.
DecHead
A decoding atlv stream at the beginning of a value.
DecTag
A decoding atlv stream just after the tag and kind have been decoded.
Decoded
A decoding atlv stream at the end of a value, and the value that was decoded.
EncArray
An encoding atlv stream in midst of an array of values.
EncBinary
An encoding atlv stream in the midst of a binary value.
EncHead
An encoding atlv stream at the beginning of a value.
Encoded
An encoding atlv stream at the end of a value.

Enums§

Error
Errors that can come up while parsing.
Kind
The different kinds of atlv values.
Value
A generic representation of an atlv value.

Constants§

MAX_ARRAY_LEN
This is the maximum length of an array that the builtin Codec implementations will accept.
MAX_BINARY_LEN
This is the maximum number of bytes of binary that the builtin Codec implementations will accept.

Traits§

Codec
Types that are encodable and decodable with atlv.

Functions§

decode
Decode a value from some reader.
encode
Encode a value to some writer.
prop_enc_dec
Generate arbitrary values of a type and test that encoding then decoding results in the original value.

Type Aliases§

Decoder
A function that decodes a single value from an atlv stream.
Encoder
A function that encodes a single value to an atlv stream.