Struct rink_core::number::NumberParts [−][src]
Several stringified properties of a number which are useful for displaying it to a user.
Fields
exact_value: Option<String>
Present if the number can be concisely represented exactly. May be decimal, fraction, or scientific notation.
approx_value: Option<String>
Present if the number can’t be exactly concisely represented in decimal or scientific notation.
factor: Option<String>
Numerator factor by which the value is multiplied, if not one.
divfactor: Option<String>
Divisor factor, if not one.
raw_unit: Option<Quantity>
High-level unit decomposition, in format that can be manipulated.
unit: Option<String>
Higher-level unit decomposition, if available.
quantity: Option<String>
The physical quantity associated with the unit, if available.
dimensions: Option<String>
The dimensionality of the unit.
raw_dimensions: Option<Quantity>
Map of base units and their dimensions.
Implementations
impl NumberParts
[src]
pub fn format(&self, pat: &str) -> String
[src]
A DSL for formatting numbers.
a
: Approximate numerical value, if exists.e
: Exact numerical value, if exists.n
: Exact and approximate values.u
: Unit.q
: Quantity, if exists.w
: Quantity in parentheses, if exists.d
: Dimensionality, if not same as unit.D
: Dimensionality, always.p
: Quantity and dimensionality in parentheses.
Display impl is equivalent to n u w
.
Whitespace is compacted. Any unrecognized characters are passed through.
pub fn token_format<'a>(&'a self, pattern: &'a str) -> NumberPartsFmt<'a>
[src]
A DSL for formatting numbers.
a
: Approximate numerical value, if exists.e
: Exact numerical value, if exists.n
: Exact and approximate values.u
: Unit.q
: Quantity, if exists.w
: Quantity in parentheses, if exists.d
: Dimensionality, if not same as unit.D
: Dimensionality, always.p
: Quantity and dimensionality in parentheses.
Display impl is equivalent to n u w
.
Whitespace is compacted. Any unrecognized characters are passed through.
Trait Implementations
impl Clone for NumberParts
[src]
fn clone(&self) -> NumberParts
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for NumberParts
[src]
impl Default for NumberParts
[src]
fn default() -> NumberParts
[src]
impl<'de> Deserialize<'de> for NumberParts
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Display for NumberParts
[src]
impl Serialize for NumberParts
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'a> TokenFmt<'a> for NumberParts
[src]
Auto Trait Implementations
impl RefUnwindSafe for NumberParts
impl Send for NumberParts
impl Sync for NumberParts
impl Unpin for NumberParts
impl UnwindSafe for NumberParts
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
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>,