pub struct Numeral {
    pub value: isize,
    pub base_10: bool,
    pub ordinal: bool,
    pub lines: bool,
    pub little_endian: bool,
}
Expand description

A numeric value, paired with formatting information.

Fields§

§value: isize

Numeric value.

§base_10: bool

Whether the number will be displayed in Decimal, base 10, rather than in Duodecimal, base 12.

§ordinal: bool

Whether the number is ordinal (“first”), rather than cardinal (“one”).

§lines: bool

Whether the base of the number will be denoted with lines, rather than with dots.

§little_endian: bool

Whether the less significant digits of will be written first. This is the style preferred by the Eldar, but as the least significant digit is marked, it can go either way without ambiguity.

Implementations§

source§

impl Numeral

source

pub const PREF_NEG_OUT: char = '-'

Prefix to be prepended to the output form of a negative number.

source

pub const PREF_POS_OUT: char = '+'

Prefix to be prepended to the output form of a positive number.

source

pub const SUFF_ORD_OUT: char = '\u{e018}'

Suffix to be appended to the output form of an ordinal number.

source

pub const fn new(value: isize, base_10: bool) -> Self

Define a value in either Base-10 or Base-12.

source

pub const fn decimal(value: isize) -> Self

Define a Base-10 decimal value.

source

pub const fn duodecimal(value: isize) -> Self

Define a Base-12 duodecimal, or dozenal, value.

source

pub const fn with_decimal(self, decimal: bool) -> Self

source

pub const fn with_lines(self, lines: bool) -> Self

source

pub const fn with_ordinal(self, ordinal: bool) -> Self

source§

impl Numeral

source

pub fn parse(slice: &[char]) -> Option<(Self, usize)>

Try to extract a numeric value from a slice of chars. If successful, returns a new Numeral, along with the number of chars that were processed in order to find it.

Trait Implementations§

source§

impl Clone for Numeral

source§

fn clone(&self) -> Numeral

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Numeral

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Numeral

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<N: Into<isize>> From<N> for Numeral

source§

fn from(value: N) -> Self

Converts to this type from the input type.
source§

impl Copy for Numeral

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.