Macro finite_fields::nary_type [] [src]

macro_rules! nary_type {
    ($tyname:ident,
   $unit_tyname:ident,
   $arity:expr,
   $storsize:ident,
   $fieldwidth:expr) => { ... };
}

A macro that defines an n-ary field type.

The first argument is the desired type name as an unquoted string.

The second argument is the desired type name for a single digit (e.g., b1 for a bit), also as an unquoted string.

The second argument is the arity (e.g. 2 for binary). It should be integral.

The third argument defines the storage type used to store the digit, since that is the underlying vocabulary Rust allows us to work with. So it must be a valid numeric type large enough to store the arity, and one that implements basic arithmetic (e.g., u8, u16).

The fourth argument defines the field width, (i.e., the number of digits in the number). For example, 3 will create a type with three digits of arity defined in the second argument.

The result will be a newtype struct and associated arithmetic implementations.