[][src]Crate xvii

XVII

...Pronounced any way you like--including "seventeen."

This library provides parsing and formatting for Roman numerals. According to my (probably extremely suspect) benchmarks, this is the best-performing library of its kind available on crates.io (you know, as of St. Patrick's Day, 2017 when I did the tests), so you should definitely employ it in your high-availability NAAS (numerals-as-a-service) project.

(Seriously, though, read the license--no warranties implied!)

let seventeen: Roman = "XVII".parse().unwrap();
assert_eq!(17, seventeen.value());
assert_eq!("XVII", seventeen.to_string());

let seventeen = Roman::new(17).unwrap();
assert_eq!(17, seventeen.value());
assert_eq!("XVII", seventeen.to_string());

no_std support

no_std mode is supported if crate is built without std feature (enabled by default). I.e. you need to turn off default features to build xvii without std:

xvii = { version = "...", default-features = false }

Structs

Roman

A Roman numeral.

RomanFormatter

Lazy roman formatter.

Enums

Error

An error in parsing a Roman numeral.

Style

Style of formatting — lowercase or uppercase.

Type Definitions

Result

Result with error defaulted to xvii::Error