[−][src]Struct septem::Roman
A Roman number
Stores the value internally a u32
Implementations
impl Roman
[src]
pub fn from<T: Into<u32>>(val: T) -> Result<Self>
[src]
Creates a Roman numeral for any value that implements Into<u32>
. Requires value to be
greater than 0, and less than 4000.
Examples
let sept: Roman = Roman::from(7u32).unwrap(); assert_eq!("VII", sept.to_string());
Returns Roman
, or an `septem::Error
pub fn from_unchecked<T: Into<u32>>(val: T) -> Self
[src]
Creates a Roman numeral for any value that implements Into<u32>
. Does not to any range
checking, so can result in weird numerals.
Examples
let sept: Roman = Roman::from_unchecked(5032u32); assert_eq!("MMMMMXXXII", sept.to_string());
Returns Roman
pub fn to_lowercase(self) -> String
[src]
Returns lowercase string representation of the Roman numeral
pub fn to_uppercase(self) -> String
[src]
Returns uppercase string representation of the Roman numeral
pub fn to_digits(self) -> Vec<Digit>
[src]
Returns vector of digits representing the roman numeral
Methods from Deref<Target = u32>
pub const MIN: u32
1.43.0[src]
pub const MAX: u32
1.43.0[src]
pub const BITS: u32
[src]
pub fn as_ne_bytes(&self) -> &[u8; 4]
[src]
num_as_ne_bytes
)Return the memory representation of this integer as a byte array in native byte order.
to_ne_bytes
should be preferred over this whenever possible.
Examples
#![feature(num_as_ne_bytes)] let num = 0x12345678u32; let bytes = num.as_ne_bytes(); assert_eq!( bytes, if cfg!(target_endian = "big") { &[0x12, 0x34, 0x56, 0x78] } else { &[0x78, 0x56, 0x34, 0x12] } );
Trait Implementations
impl AsRef<u32> for Roman
[src]
Support dereferencing to u32
Examples
let sept: Roman = Roman::from(7u32).unwrap(); let r: &u32 = &sept; assert_eq!(&7, r);
impl Clone for Roman
[src]
impl Copy for Roman
[src]
impl Debug for Roman
[src]
impl Deref for Roman
[src]
type Target = u32
The resulting type after dereferencing.
fn deref(&self) -> &u32
[src]
Returns the integer representation of the Roman numeral
impl Display for Roman
[src]
impl Eq for Roman
[src]
impl FromStr for Roman
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Error>
[src]
Creates a Roman numeral from a string representing the roman numerals
Examples
let sept: Roman = "VII".parse().unwrap(); assert_eq!(7, *sept);
Returns Roman
, or an septem::Error
impl Ord for Roman
[src]
fn cmp(&self, other: &Roman) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Roman> for Roman
[src]
impl PartialOrd<Roman> for Roman
[src]
fn partial_cmp(&self, other: &Roman) -> Option<Ordering>
[src]
fn lt(&self, other: &Roman) -> bool
[src]
fn le(&self, other: &Roman) -> bool
[src]
fn gt(&self, other: &Roman) -> bool
[src]
fn ge(&self, other: &Roman) -> bool
[src]
impl Send for Roman
[src]
impl StructuralEq for Roman
[src]
impl StructuralPartialEq for Roman
[src]
impl Sync for Roman
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,