pub struct Roman { /* private fields */ }Expand description
A sequence of Roman numerals.
Implementations§
Source§impl Roman
impl Roman
Sourcepub fn parse(input: &str) -> Option<Self>
pub fn parse(input: &str) -> Option<Self>
Parses a string of characters into a sequence of numerals. Returns
None if there’s a character in the input string that doesn’t map to
a numeral.
This accepts either uppercase or lowercase ASCII characters.
Sourcepub fn value(&self) -> i16
pub fn value(&self) -> i16
Converts this string of numerals into a i32 actual number.
§Panics
- This function panics when passed in a negative number or zero, as the Romans didn’t have a way to write those down!
Sourcepub fn value_checked(&self) -> Option<i16>
pub fn value_checked(&self) -> Option<i16>
Converts this string of numerals into a i32 actual number.
Unlike value, this returns None on numbers that can’t be converted to an i32.
Trait Implementations§
impl StructuralPartialEq for Roman
Auto Trait Implementations§
impl Freeze for Roman
impl RefUnwindSafe for Roman
impl Send for Roman
impl Sync for Roman
impl Unpin for Roman
impl UnsafeUnpin for Roman
impl UnwindSafe for Roman
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more