A helpful macro for instantiating Decimal
numbers.
By default, this requires rust_decimal
to be available at the project root. e.g. the macro
will effectively produce:
::rust_decimal::Decimal::from_parts(12345, 0, 0, false, 4)
While this is convenient for most use cases, it is sometimes not desired behavior when looking
to reexport the libray. Consequently, this behavior can be modified by enabling the feature
reexportable
. When this feature is enabled, the macro will instead reproduce the functional
equivalent of:
Decimal::from_parts(12345, 0, 0, false, 4)
Examples
use dec;
// If the reexportable feature is enabled, `Decimal` needs to be in scope
use Decimal;
let number = dec!;
assert_eq!;
let number = dec!;
assert_eq!;