Available on crate feature
types only.Expand description
§Type parser for binary encoded types
This module provides functions to parse a binary encoded type into a
Type. The binary encoding is a compact representation of a type that can
be used to serialize and deserialize types.
The binary encoding is a sequence of bytes that represents a type. The encoding is a simple grammar that can be parsed into a type. The grammar is defined as follows:
type = (filled | option | code::VOID | code::NIL) eof
filled = code::ANY | union | specific
specific = code::TYPE | code::BOOL | code::CHAR | code::INT
| code::FLOAT | code::SYMBOL | code::BINARY
| array | pair | lambda
array = code::ARRAY filled-option fixed
pair = code::PAIR filled-option filled-option
lambda = code::LAMBDA params variadic return
params = (filled-option)*
variadic = (code::VARIADIC filled-option)?
return = code::RETURN (code::VOID | filled-option)
option = code::OPTION filled
union = code::UNION specific specific+ code::END
fixed = (fixed0 | fixed1 | fixed2 | fixed3 | fixed4)?
fixed0 = code::FIXED0..=code::FIXED0_MAX
fixed1 = code::FIXED1..=code::FIXED1_MAX byte
fixed2 = code::FIXED2..=code::FIXED2_MAX byte byte
fixed3 = code::FIXED3..=code::FIXED3_MAX byte byte byte
fixed4 = code::FIXED4..=code::FIXED4_MAX byte byte byte byte
byte = 0x00..=0xFFFunctions§
- parse
- Parse a type code stream into a type.
- parse_
array - Parse a type code stream into an array type.
- parse_
filled - Parse a type code stream into a filled type.
- parse_
filled_ option - Parse a type code stream into a filled type or an option type.
- parse_
fixed - Parse a type code stream into an optional fixed length value.
- parse_
lambda - Parse a type code stream into a lambda type.
- parse_
option - Parse a type code stream into an option type.
- parse_
pair - Parse a type code stream into a pair type.
- parse_
params - Parse a type code stream into a sequence of parameters, which may filled or option types. The sequence may be of zero length. Parses until no more parameters can be found.
- parse_
return - Parse a type code stream into a return type.
- parse_
specific - Parse a type code stream into a specific type.
- parse_
union - Parse a type code stream into a union type.
- parse_
variadic - Parse a type code stream into an optional variadic type.