Struct xvii::Roman [−][src]
pub struct Roman(_);
A Roman numeral.
This struct stores the value of a numeral as an i32
but provides
for Roman-style formatting.
Methods
impl Roman
[src]
impl Roman
pub fn from(n: i32) -> Option<Roman>
[src]
pub fn from(n: i32) -> Option<Roman>
Creates a Roman
value based on an i32
.
This function will return None
if the value supplied is outside the
acceptable range of 1...4999
, because numbers outside that range
cannot be appropriately formatted using the seven standard numerals.
pub fn from_unchecked(n: i32) -> Roman
[src]
pub fn from_unchecked(n: i32) -> Roman
Creates a Roman
value based on an i32
.
This function will return any i32
wrapped in a Roman
newtype
without bothering to check its range, regardless of how unprintable
it is.
Note: being "unprintable" is not memory unsafe and will not panic.
pub fn to_uppercase(self) -> String
[src]
pub fn to_uppercase(self) -> String
Formats a Roman
value as an uppercase Roman numeral.
pub fn to_lowercase(self) -> String
[src]
pub fn to_lowercase(self) -> String
Formats a Roman
value as a lowercase Roman numeral.
Methods from Deref<Target = i32>
Trait Implementations
impl Copy for Roman
[src]
impl Copy for Roman
impl Clone for Roman
[src]
impl Clone for Roman
fn clone(&self) -> Roman
[src]
fn clone(&self) -> Roman
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Roman
[src]
impl Debug for Roman
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for Roman
[src]
impl Eq for Roman
impl PartialEq for Roman
[src]
impl PartialEq for Roman
fn eq(&self, other: &Roman) -> bool
[src]
fn eq(&self, other: &Roman) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Roman) -> bool
[src]
fn ne(&self, other: &Roman) -> bool
This method tests for !=
.
impl Ord for Roman
[src]
impl Ord for Roman
fn cmp(&self, other: &Roman) -> Ordering
[src]
fn cmp(&self, other: &Roman) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd for Roman
[src]
impl PartialOrd for Roman
fn partial_cmp(&self, other: &Roman) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Roman) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Roman) -> bool
[src]
fn lt(&self, other: &Roman) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Roman) -> bool
[src]
fn le(&self, other: &Roman) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Roman) -> bool
[src]
fn gt(&self, other: &Roman) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Roman) -> bool
[src]
fn ge(&self, other: &Roman) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Hash for Roman
[src]
impl Hash for Roman
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl AsRef<i32> for Roman
[src]
impl AsRef<i32> for Roman
impl Deref for Roman
[src]
impl Deref for Roman
type Target = i32
The resulting type after dereferencing.
fn deref(&self) -> &i32
[src]
fn deref(&self) -> &i32
Dereferences the value.
impl FromStr for Roman
[src]
impl FromStr for Roman
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Error>
[src]
fn from_str(s: &str) -> Result<Self, Error>
Parses a string s
to return a value of this type. Read more
impl Display for Roman
[src]
impl Display for Roman