Number

Struct Number 

Source
pub struct Number {
    pub value: f64,
    pub suffix: Suffix,
}

Fields§

§value: f64§suffix: Suffix

Implementations§

Source§

impl Number

Source

pub const fn new(value: f64, suffix: Suffix) -> Self

Source

pub const fn to_f64(&self) -> f64

Source

pub fn from_f64<F: Into<f64>>(val: F) -> Self

Source

pub fn zero() -> Self

Source

pub fn is_zero(&self) -> bool

Source

pub fn is_nan(self) -> bool

Source

pub fn is_finite(self) -> bool

Source

pub fn powf(self, exp: f64) -> Self

Source

pub fn atan2(self, other: Number) -> Self

Source§

impl Number

Source

pub fn abs(&self) -> Self

Source

pub fn ceil(&self) -> Self

Source

pub fn floor(&self) -> Self

Source

pub fn round(&self) -> Self

Source

pub fn trunc(&self) -> Self

Source

pub fn fract(&self) -> Self

Source

pub fn sqrt(&self) -> Self

Source

pub fn exp(&self) -> Self

Source

pub fn ln(&self) -> Self

Source

pub fn log10(&self) -> Self

Source

pub fn log2(&self) -> Self

Source

pub fn recip(&self) -> Self

Source

pub fn sin(&self) -> Self

Source

pub fn cos(&self) -> Self

Source

pub fn tan(&self) -> Self

Source

pub fn asin(&self) -> Self

Source

pub fn acos(&self) -> Self

Source

pub fn atan(&self) -> Self

Source

pub fn sinh(&self) -> Self

Source

pub fn cosh(&self) -> Self

Source

pub fn tanh(&self) -> Self

Source

pub fn to_degrees(&self) -> Self

Source

pub fn to_radians(&self) -> Self

Trait Implementations§

Source§

impl Add<Number> for f64

Source§

type Output = Number

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Number) -> Number

Performs the + operation. Read more
Source§

impl Add<f64> for Number

Source§

type Output = Number

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Number

Performs the + operation. Read more
Source§

impl Add for Number

Source§

type Output = Number

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Number) -> Number

Performs the + operation. Read more
Source§

impl Clone for Number

Source§

fn clone(&self) -> Number

Returns a duplicate 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 Number

Source§

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

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

impl<'de> Deserialize<'de> for Number

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Number

Source§

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

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

impl<U: Unit> Div<Number> for UnitNumber<U>

Source§

type Output = UnitNumber<U>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Number) -> Self

Performs the / operation. Read more
Source§

impl Div<Number> for f64

Source§

type Output = Number

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Number) -> Number

Performs the / operation. Read more
Source§

impl Div<f64> for Number

Source§

type Output = Number

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Number

Performs the / operation. Read more
Source§

impl Div for Number

Source§

type Output = Number

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Number) -> Number

Performs the / operation. Read more
Source§

impl<U: Unit> From<Number> for UnitNumber<U>

Source§

fn from(value: Number) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Number

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Number

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Number

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Number

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Number

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<U: Unit> Mul<Number> for UnitNumber<U>

Source§

type Output = UnitNumber<U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Number) -> Self

Performs the * operation. Read more
Source§

impl Mul<Number> for f64

Source§

type Output = Number

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Number) -> Number

Performs the * operation. Read more
Source§

impl<U: Unit> Mul<UnitNumber<U>> for Number

Source§

type Output = UnitNumber<U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: UnitNumber<U>) -> UnitNumber<U>

Performs the * operation. Read more
Source§

impl Mul<f64> for Number

Source§

type Output = Number

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Number

Performs the * operation. Read more
Source§

impl Mul for Number

Source§

type Output = Number

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Number) -> Number

Performs the * operation. Read more
Source§

impl Neg for Number

Source§

type Output = Number

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Ord for Number

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq<Number> for f64

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<f64> for Number

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Number

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<Number> for f64

Source§

fn partial_cmp(&self, other: &Number) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd<f64> for Number

Source§

fn partial_cmp(&self, other: &f64) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for Number

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<Number> for f64

Source§

type Output = Number

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Number) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<f64> for Number

Source§

type Output = Number

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: f64) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for Number

Source§

type Output = Number

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Number) -> Self::Output

Performs the % operation. Read more
Source§

impl Serialize for Number

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub<Number> for f64

Source§

type Output = Number

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Number) -> Number

Performs the - operation. Read more
Source§

impl Sub<f64> for Number

Source§

type Output = Number

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Number

Performs the - operation. Read more
Source§

impl Sub for Number

Source§

type Output = Number

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Number) -> Number

Performs the - operation. Read more
Source§

impl Copy for Number

Source§

impl Eq for Number

Source§

impl StructuralPartialEq for Number

Auto Trait Implementations§

§

impl Freeze for Number

§

impl RefUnwindSafe for Number

§

impl Send for Number

§

impl Sync for Number

§

impl Unpin for Number

§

impl UnwindSafe for Number

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,