[−][src]Macro generic_modular::def_modular
This macro generates a struct that implements Modular
.
See ExampleModular101
for an example of what is generated.
Parameters
$name
is the name of the struct to be generated.$int
is the type of integer to work with. It must be one ofu8
,u16
,u32
,u64
oru128
.$sint
is the type of integer to work with. It must be the signed version of$int
, i.e.i8
,i16
,i32
,i64
ori128
.$mod
is the modulus of this type of modular value. It must be a const value. It must satisfy$mod * $mod < $int::max_value()
and$mod * 2 < $sint::max_value()
.$label
is a dummy label name for static assertions. This is unused on nightly builds with theunderscore_const_names
feature.
Example
ⓘThis example is not tested
def_modular!(ExampleModular101 : u16 | i16, 101 ; some_random_label #[doc = "your own documentation here"]);