Expand description

This crate exists because of limitations with proc-macro crates. We need to be able to test errors returned from the code generation function while also being able to test the macros themselves. This might also be reused by people who have new storage types.


This is a special purpose structure that can efficiently handle forwards and backwards lookups and maintains the set property. A is associated data that is not hashed or used in equality comparisons.

For concatenation widths

Note: the type must be unambiguous for the construction functions

Prefixes used for codegen names and functions. Most of these should be prefixed with two underscores and the crate name to prevent collisions.

Usize and/or String Bound. If s.is_empty(), then there is no arbitrary string in the bound and the base value is 0. x is added on to the value.


Bitwidth as described by a single value or one value minus another


Default names for awint


For results that have the same Ok and Err types


Input parsing and code generation function for corresponding concatenations of components macros.

Lowering of the parsed structs into Rust code.

Wrap s in ANSI delimiters for terminal colors. {90..=97} => {grey, red, green, yellow, blue, purple, cyan, white}

Tries parsing as hexadecimal, octal, binary, and decimal

Tries to parse raw input as a range. Looks for the existence of top level “..” or “..=” punctuation. If allow_single_bit_range is set, will return a single bit range if “..” or “..=” does not exist.

In ranges we commonly see stuff like (x + y) or (x - y) with one of them being a constant we can parse, which passes upward the Usb and Usbr chain to get calculated into a static width.

Looks for the existence of a top level “[]” delimited group and uses the last one as a bit range.

Parses input TokenStream into “raw” concatenations of components in Vec<char> strings

Returns architecture-independent Rust code that returns an InlAwi preset with the value of bits.

Returns architecture-independent Rust code that returns an InlAwi type with bitwidth bw.