Struct rink_core::number::Number [−][src]
The basic representation of a number with a unit.
Fields
value: Numeric
unit: Quantity
Implementations
impl Number
[src]
pub fn one() -> Number
[src]
pub fn one_unit(unit: Dimension) -> Number
[src]
pub fn zero() -> Number
[src]
pub fn new(num: Numeric) -> Number
[src]
Creates a dimensionless value.
pub fn new_unit(num: Numeric, unit: Dimension) -> Number
[src]
Creates a value with a single dimension.
pub fn from_parts(
integer: &str,
frac: Option<&str>,
exp: Option<&str>
) -> Result<Numeric, String>
[src]
integer: &str,
frac: Option<&str>,
exp: Option<&str>
) -> Result<Numeric, String>
pub fn invert(&self) -> Number
[src]
Computes the reciprocal (1/x) of the value.
pub fn powi(&self, exp: i32) -> Number
[src]
Raises a value to a dimensionless integer power.
pub fn root(&self, exp: i32) -> Result<Number, String>
[src]
Computes the nth root of a value iff all of its units have powers divisible by n.
pub fn pow(&self, exp: &Number) -> Result<Number, String>
[src]
pub fn numeric_value(
&self,
base: u8,
digits: Digits
) -> (Option<String>, Option<String>)
[src]
&self,
base: u8,
digits: Digits
) -> (Option<String>, Option<String>)
pub fn to_parts_simple(&self) -> NumberParts
[src]
pub fn prettify(&self, context: &Context) -> Number
[src]
Convert the units of the number from base units to display units, and possibly apply SI prefixes.
pub fn to_parts(&self, context: &Context) -> NumberParts
[src]
pub fn unit_to_string(unit: &Quantity) -> String
[src]
pub fn complexity_score(&self) -> i64
[src]
pub fn dimless(&self) -> bool
[src]
Trait Implementations
impl<'a, 'b> Add<&'b Number> for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the +
operator.
fn add(self, other: &Number) -> Self::Output
[src]
impl Clone for Number
[src]
impl Debug for Number
[src]
impl<'a, 'b> Div<&'b Number> for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the /
operator.
fn div(self, other: &Number) -> Self::Output
[src]
impl<'a, 'b> Div<&'b Number> for &'a Substance
[src]
type Output = Result<Substance, String>
The resulting type after applying the /
operator.
fn div(self, other: &'b Number) -> Self::Output
[src]
impl<'a, 'b> Mul<&'b Number> for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the *
operator.
fn mul(self, other: &Number) -> Self::Output
[src]
impl<'a, 'b> Mul<&'b Number> for &'a Substance
[src]
type Output = Result<Substance, String>
The resulting type after applying the *
operator.
fn mul(self, other: &'b Number) -> Self::Output
[src]
impl<'a> Neg for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl PartialEq<Number> for Number
[src]
impl Show for Number
[src]
impl StructuralPartialEq for Number
[src]
impl<'a, 'b> Sub<&'b Number> for &'a Number
[src]
Auto Trait Implementations
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
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, 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>,