roman-literals
roman-literals
provides an easy way to write integer literals using Roman
numerals.
roman!
] macroType aliases like [iXXXII
] are provided to replace primitive types like
[i32
].
Using the [roman!
] macro, the type of the literal is automatically
inferred, with [iXXXII
] being the default. The macro also supports
negative numbers; see [roman!
] for more details.
Constants are also provided, such as III_uXXXII
. These constants are all
suffixed with their type. See the [consts
] module for more details.
```rust use roman_literals::*; // roman! macro and type aliases
let fortytwo: uXXXII = roman!(XLII); asserteq!(forty_two, 42);
let negative3999: iXVI = roman!(-MMMCMXCIX); asserteq!(negative_3999, -3999);
use roman_literals::consts::*; // to get the constants
let negative300 = -CCCiLXIV; // i64 asserteq!(negative300, -300); ```
Why not?