Skip to main content

Crate newnum_proc_macros

Crate newnum_proc_macros 

Source

Macros§

internal_num
Is num! but uses crate as the crate path. This is useful for macros that are used in the newnum crate itself.
internal_num_approx
Is num_approx! but uses crate as the crate path. This is useful for macros that are used in the newnum crate itself.
num
Converts a numeric literal into a Num type, generating a compile-time error if the literal is out of range for the type.
num_approx
Converts a numeric literal into a Num type, generating a compile-time error if the literal is out of range for the type. In comparison to num!, this macro also accepts literals that can only be approximately represented by the type.

Derive Macros§

AHyper
AHyper derive macro. for each method, the derive implementation maps each field using the method.
ATrig
ATrig derive macro. for each method, the derive implementation maps each field using the method.
AbsDiff
AbsDiff derive macro. maps each field using the method.
AlwaysNegative
AlwaysPositive
AlwaysZero
FullySigned
Hyper
Hyper derive macro. for each method, the derive implementation maps each field using the method.
MinMax
MinMax derive macro. for each method, the derive implementation maps each field using the method. Throws a compile-time error for enums unless you use the flat_minmax attribute.
Negative
NegativeOrZero
NotNegative
NotPositive
NotZero
Num
Num derive macro. Num is an empty trait that has many super-traits, this macro only derives Num and not its super-traits.
Positive
PositiveOrNegative
PositiveOrZero
Root
Root derive macro. for each method, the derive implementation maps each field using the method.
Round
Round derive macro. for each method, the derive implementation maps each field using the method.
Signed
Signed derive macro. Signed is a trait with methods that check sign attributes. This macro expects the type to only have one field, and redirects the trait methods to the field as Signed.
Trig
Trig derive macro. for each method, the derive implementation maps each field using the method.
TruncRoot
TruncRoot derive macro. for each method, the derive implementation maps each field using the method.
TypeMax
TypeMax derive macro. Initializes the type_max of each field, and for enum requires a single variant to be labeled as type_max.
TypeMin
TypeMin derive macro. Initializes the type_min of each field, and for enum requires a single variant to be labeled as type_min.
Whole
Whole derive macro. Whole is a trait that has no methods and is used to mark types as always round. This derive macro doesn’t verify anything about the data in the type, so make sure the type should be Whole when using this derive macro.
Zero