pub enum Number {
    Int(i64),
    Float(f64),
    Decimal(Decimal),
}

Variants§

§

Int(i64)

§

Float(f64)

§

Decimal(Decimal)

Implementations§

source§

impl Number

source

pub const NAN: Number = _

source

pub fn is_nan(&self) -> bool

source

pub fn is_int(&self) -> bool

source

pub fn is_float(&self) -> bool

source

pub fn is_decimal(&self) -> bool

source

pub fn is_integer(&self) -> bool

source

pub fn is_truthy(&self) -> bool

source

pub fn is_positive(&self) -> bool

source

pub fn is_negative(&self) -> bool

source

pub fn is_zero(&self) -> bool

source

pub fn is_zero_or_positive(&self) -> bool

source

pub fn is_zero_or_negative(&self) -> bool

source

pub fn as_usize(self) -> usize

source

pub fn as_int(self) -> i64

source

pub fn as_float(self) -> f64

source

pub fn as_decimal(self) -> Decimal

source

pub fn to_usize(&self) -> usize

source

pub fn to_int(&self) -> i64

source

pub fn to_float(&self) -> f64

source

pub fn to_decimal(&self) -> Decimal

source

pub fn abs(self) -> Self

source

pub fn acos(self) -> Self

source

pub fn ceil(self) -> Self

source

pub fn floor(self) -> Self

source

pub fn round(self) -> Self

source

pub fn fixed(self, precision: usize) -> Number

source

pub fn sqrt(self) -> Self

source

pub fn pow(self, power: Number) -> Number

Trait Implementations§

source§

impl<'a, 'b> Add<&'b Number> for &'a Number

§

type Output = Number

The resulting type after applying the + operator.
source§

fn add(self, other: &'b Number) -> Number

Performs the + operation. Read more
source§

impl Add for Number

§

type Output = Number

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl Clone for Number

source§

fn clone(&self) -> Number

Returns a copy 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 Default for Number

source§

fn default() -> Self

Returns the “default value” for a type. 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<'a, 'b> Div<&'b Number> for &'a Number

§

type Output = Number

The resulting type after applying the / operator.
source§

fn div(self, other: &'b Number) -> Number

Performs the / operation. Read more
source§

impl Div for Number

§

type Output = Number

The resulting type after applying the / operator.
source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
source§

impl From<Decimal> for Number

source§

fn from(v: Decimal) -> Self

Converts to this type from the input type.
source§

impl From<Number> for Id

source§

fn from(v: Number) -> Self

Converts to this type from the input type.
source§

impl From<Number> for Part

source§

fn from(v: Number) -> Self

Converts to this type from the input type.
source§

impl From<Number> for Value

source§

fn from(v: Number) -> Self

Converts to this type from the input type.
source§

impl From<f32> for Number

source§

fn from(f: f32) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Number

source§

fn from(f: f64) -> Self

Converts to this type from the input type.
source§

impl From<i128> for Number

source§

fn from(i: i128) -> Self

Converts to this type from the input type.
source§

impl From<i16> for Number

source§

fn from(i: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for Number

source§

fn from(i: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for Number

source§

fn from(i: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for Number

source§

fn from(i: i8) -> Self

Converts to this type from the input type.
source§

impl From<isize> for Number

source§

fn from(i: isize) -> Self

Converts to this type from the input type.
source§

impl From<u128> for Number

source§

fn from(i: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for Number

source§

fn from(i: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for Number

source§

fn from(i: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Number

source§

fn from(i: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for Number

source§

fn from(i: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for Number

source§

fn from(i: usize) -> Self

Converts to this type from the input type.
source§

impl FromStr for Number

§

type Err = ()

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 Hash for Number

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, 'b> Mul<&'b Number> for &'a Number

§

type Output = Number

The resulting type after applying the * operator.
source§

fn mul(self, other: &'b Number) -> Number

Performs the * operation. Read more
source§

impl Mul for Number

§

type Output = Number

The resulting type after applying the * operator.
source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
source§

impl Neg for Number

§

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 + PartialOrd,

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

impl PartialEq for Number

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a> Product<&'a Number> for Number

source§

fn product<I>(iter: I) -> Number
where I: Iterator<Item = &'a Self>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Product for Number

source§

fn product<I>(iter: I) -> Number
where I: Iterator<Item = Self>,

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Revisioned for Number

source§

fn revision() -> u16

Returns the current revision of this type.

source§

fn serialize_revisioned<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Serializes the struct using the specficifed writer.

source§

fn deserialize_revisioned<R: Read>(reader: &mut R) -> Result<Self, Error>

Deserializes a new instance of the struct from the specficifed reader.

source§

fn type_id() -> TypeId
where Self: 'static,

Returns the type id of this type.
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<'a, 'b> Sub<&'b Number> for &'a Number

§

type Output = Number

The resulting type after applying the - operator.
source§

fn sub(self, other: &'b Number) -> Number

Performs the - operation. Read more
source§

impl Sub for Number

§

type Output = Number

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<'a> Sum<&'a Number> for Number

source§

fn sum<I>(iter: I) -> Number
where I: Iterator<Item = &'a Self>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Sum for Number

source§

fn sum<I>(iter: I) -> Number
where I: Iterator<Item = Self>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl TryFrom<&str> for Number

§

type Error = ()

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

fn try_from(v: &str) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for Decimal

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for f32

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for f64

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i128

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i16

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i32

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i64

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for i8

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u128

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u16

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u32

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u64

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Number> for u8

§

type Error = Error

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

fn try_from(value: Number) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Strand> for Number

§

type Error = ()

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

fn try_from(v: Strand) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<String> for Number

§

type Error = ()

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

fn try_from(v: String) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<Value> for Number

§

type Error = Error

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

fn try_from(value: Value) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for Number

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
§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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§

default 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>,

§

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>,

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

source§

fn is_within(&self, b: &G2) -> bool

source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

source§

fn is_within(&self, b: &G2) -> bool

source§

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

§

impl<T> ParallelSend for T
where T: Send,