Struct rink::number::Number
[−]
[src]
pub struct Number { pub value: Num, pub unit: Unit, }
The basic representation of a number with a unit.
Fields
value: Num
unit: Unit
Methods
impl Number
[src]
fn one() -> Number
fn one_unit(unit: Dim) -> Number
fn zero() -> Number
fn new(num: Num) -> Number
Creates a dimensionless value.
fn new_unit(num: Num, unit: Dim) -> Number
Creates a value with a single dimension.
fn from_parts(
integer: &str,
frac: Option<&str>,
exp: Option<&str>
) -> Result<Num, String>
integer: &str,
frac: Option<&str>,
exp: Option<&str>
) -> Result<Num, String>
fn invert(&self) -> Number
Computes the reciprocal (1/x) of the value.
fn powi(&self, exp: i32) -> Number
Raises a value to a dimensionless integer power.
fn root(&self, exp: i32) -> Result<Number, String>
Computes the nth root of a value iff all of its units have powers divisible by n.
fn pow(&self, exp: &Number) -> Result<Number, String>
fn numeric_value(
&self,
base: u8,
digits: Digits
) -> (Option<String>, Option<String>)
&self,
base: u8,
digits: Digits
) -> (Option<String>, Option<String>)
fn to_parts_simple(&self) -> NumberParts
fn prettify(&self, context: &Context) -> Number
Convert the units of the number from base units to display units, and possibly apply SI prefixes.
fn to_parts(&self, context: &Context) -> NumberParts
fn unit_to_string(unit: &Unit) -> String
fn complexity_score(&self) -> i64
fn dimless(&self) -> bool
Trait Implementations
impl Clone for Number
[src]
fn clone(&self) -> Number
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for Number
[src]
fn eq(&self, __arg_0: &Number) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Number) -> bool
This method tests for !=
.
impl Debug for Number
[src]
impl Show for Number
[src]
fn show(&self, context: &Context) -> String
Provides a string representation of something, using information contained in a Context.
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
The method for the +
operator
impl<'a, 'b> Sub<&'b Number> for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the -
operator
fn sub(self, other: &Number) -> Self::Output
The method for the -
operator
impl<'a> Neg for &'a Number
[src]
type Output = Option<Number>
The resulting type after applying the -
operator
fn neg(self) -> Self::Output
The method for the unary -
operator
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
The method for the *
operator