Skip to main content

NumberFormat

Struct NumberFormat 

Source
pub struct NumberFormat {
    pub unit: String,
    pub conversion: f64,
    pub fraction: FractionFormat,
    pub precision: u32,
    pub fixed_denominator: bool,
    pub thousands: String,
    pub radix: String,
    pub prefix_spacing: String,
    pub suffix_spacing: String,
    pub label: LabelPosition,
}
Expand description

A number format (ISO 32000-1 §12.9, Table 263): one unit of a measurement chain and how its value is shown.

Fields§

§unit: String

/U: the unit label.

§conversion: f64

/C: the factor that converts the previous unit of the chain, user space units for the first, into this one.

§fraction: FractionFormat

/F: how the fractional part is shown, decimal when absent.

§precision: u32

/D: the places of a decimal or the denominator of a fraction, 100 when absent.

§fixed_denominator: bool

/FD: whether a fraction keeps the denominator precision names instead of being reduced.

§thousands: String

/RT: the text between orders of thousands, a comma when absent.

§radix: String

/RD: the decimal point text, a period when absent.

§prefix_spacing: String

/PS: the text before the label, one space when absent.

§suffix_spacing: String

/SS: the text after the label, one space when absent.

§label: LabelPosition

/O: where the label goes, after the value when absent.

Trait Implementations§

Source§

impl Clone for NumberFormat

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NumberFormat

Source§

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

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

impl PartialEq for NumberFormat

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NumberFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.