Crates.io | numerals |
lib.rs | numerals |
version | 0.1.4 |
source | src |
created_at | 2015-05-29 15:05:42.60533 |
updated_at | 2020-04-25 14:39:13.958961 |
description | Library for numeric systems, both ancient and modern |
homepage | https://github.com/ogham/rust-numerals |
repository | |
max_upload_size | |
id | 2257 |
size | 12,412 |
This is a library for various numeric systems, including ancient, modern, and just plain strange.
Although the Roman module is likely to be the most popular, I maintain an interest in the others, so they’re all packaged as one!
This library works with Cargo.
Add the following to your Cargo.toml
dependencies section:
[dependencies]
numerals = "0.1"
The earliest version of Rust that this crate is tested against is Rust v1.31.0.
To format a number as Roman numerals, use Roman::from
to convert it, and the UpperHex
formatting trait to format it.
use numerals::roman::Roman;
let string = format!("{:X}", Roman::from(134));
assert_eq!(string, "CXXXIV");