Skip to main content

decimal

Macro decimal 

Source
macro_rules! decimal {
    ($($token:tt)+) => { ... };
}
Expand description

An exact Decimal literal, parsed at compile time.

use ocpp_kit::decimal;

let limit = decimal!(32.5);
assert_eq!(limit.scale(), 1);
assert_eq!(limit.mantissa(), 325);

The digits are read from the source text, so the value is the one written rather than the nearest f64 to it, and a malformed literal is a compile error.