Expand description
A generic number.
Variants
Bool(Boolean)
Complex(Complex)
Float(Float)
Int(Int)
UInt(UInt)
Implementations
Trait Implementations
sourceimpl AddAssign<Number> for Number
impl AddAssign<Number> for Number
sourcefn add_assign(&mut self, other: Number)
fn add_assign(&mut self, other: Number)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for Number
impl<'de> Deserialize<'de> for Number
sourcefn deserialize<D>(
deserializer: D
) -> Result<Number, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Number, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl DivAssign<Number> for Number
impl DivAssign<Number> for Number
sourcefn div_assign(&mut self, other: Number)
fn div_assign(&mut self, other: Number)
Performs the /=
operation. Read more
sourceimpl FloatInstance for Number
impl FloatInstance for Number
sourcefn is_infinite(&self) -> bool
fn is_infinite(&self) -> bool
Return true
if this Number
is infinite (e.g. f32::INFINITY
).
sourceimpl FromStream for Number
impl FromStream for Number
type Context = ()
type Context = ()
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
sourcefn from_stream<'life0, 'async_trait, D>(
_context: (),
decoder: &'life0 mut D
) -> Pin<Box<dyn Future<Output = Result<Number, <D as Decoder>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
D: 'async_trait + Decoder,
Number: 'async_trait,
fn from_stream<'life0, 'async_trait, D>(
_context: (),
decoder: &'life0 mut D
) -> Pin<Box<dyn Future<Output = Result<Number, <D as Decoder>::Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
D: 'async_trait + Decoder,
Number: 'async_trait,
Parse this value using the given Decoder
.
sourceimpl<D> Hash<D> for Number where
D: Digest,
impl<D> Hash<D> for Number where
D: Digest,
sourcefn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
fn hash(self) -> GenericArray<u8, <D as OutputSizeUser>::OutputSize>
Compute the SHA-2 hash of this value
sourceimpl<'en> IntoStream<'en> for Number
impl<'en> IntoStream<'en> for Number
sourceimpl MulAssign<Number> for Number
impl MulAssign<Number> for Number
sourcefn mul_assign(&mut self, other: Number)
fn mul_assign(&mut self, other: Number)
Performs the *=
operation. Read more
sourceimpl NumberInstance for Number
impl NumberInstance for Number
type Abs = Number
type Exp = Number
type Log = Number
type Round = Number
type Class = NumberType
sourcefn class(&self) -> NumberType
fn class(&self) -> NumberType
Get an impl of NumberClass
describing this number.
sourcefn into_type(self, dtype: NumberType) -> Number
fn into_type(self, dtype: NumberType) -> Number
Cast this number into the specified NumberClass
.
sourcefn exp(self) -> <Number as NumberInstance>::Exp
fn exp(self) -> <Number as NumberInstance>::Exp
Raise e
to the power of this number.
sourcefn ln(self) -> <Number as NumberInstance>::Log
fn ln(self) -> <Number as NumberInstance>::Log
Compute the natural logarithm of this number.
sourcefn log<N>(self, base: N) -> <Number as NumberInstance>::Log where
N: NumberInstance,
Float: From<N>,
fn log<N>(self, base: N) -> <Number as NumberInstance>::Log where
N: NumberInstance,
Float: From<N>,
Compute the logarithm of this number with respect to the given base
.
sourcefn round(self) -> <Number as NumberInstance>::Round
fn round(self) -> <Number as NumberInstance>::Round
Return this number rounded to the nearest integer.
sourcefn and(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
fn and(self, other: Self) -> Self where
Boolean: CastFrom<Self>,
Return true
if self
and other
are nonzero.
sourceimpl PartialOrd<Number> for Number
impl PartialOrd<Number> for Number
sourcefn partial_cmp(&self, other: &Number) -> Option<Ordering>
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 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn le(&self, other: &Rhs) -> bool
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
sourceimpl RemAssign<Number> for Number
impl RemAssign<Number> for Number
sourcefn rem_assign(&mut self, other: Number)
fn rem_assign(&mut self, other: Number)
Performs the %=
operation. Read more
sourceimpl Serialize for Number
impl Serialize for Number
sourcefn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
fn serialize<S>(
&self,
s: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl SubAssign<Number> for Number
impl SubAssign<Number> for Number
sourcefn sub_assign(&mut self, other: Number)
fn sub_assign(&mut self, other: Number)
Performs the -=
operation. Read more
sourceimpl Trigonometry for Number
impl Trigonometry for Number
type Out = Number
sourcefn asin(self) -> <Number as Trigonometry>::Out
fn asin(self) -> <Number as Trigonometry>::Out
Arcsine
sourcefn sin(self) -> <Number as Trigonometry>::Out
fn sin(self) -> <Number as Trigonometry>::Out
Sine
sourcefn asinh(self) -> <Number as Trigonometry>::Out
fn asinh(self) -> <Number as Trigonometry>::Out
Hyperbolic arcsine
sourcefn sinh(self) -> <Number as Trigonometry>::Out
fn sinh(self) -> <Number as Trigonometry>::Out
Hyperbolic sine
sourcefn acos(self) -> <Number as Trigonometry>::Out
fn acos(self) -> <Number as Trigonometry>::Out
Hyperbolic arccosine
sourcefn cos(self) -> <Number as Trigonometry>::Out
fn cos(self) -> <Number as Trigonometry>::Out
Cosine
sourcefn acosh(self) -> <Number as Trigonometry>::Out
fn acosh(self) -> <Number as Trigonometry>::Out
Hyperbolic arccosine
sourcefn cosh(self) -> <Number as Trigonometry>::Out
fn cosh(self) -> <Number as Trigonometry>::Out
Hyperbolic cosine
sourcefn atan(self) -> <Number as Trigonometry>::Out
fn atan(self) -> <Number as Trigonometry>::Out
Arctangent
sourcefn tan(self) -> <Number as Trigonometry>::Out
fn tan(self) -> <Number as Trigonometry>::Out
Tangent
sourcefn atanh(self) -> <Number as Trigonometry>::Out
fn atanh(self) -> <Number as Trigonometry>::Out
Hyperbolic arctangent
sourcefn tanh(self) -> <Number as Trigonometry>::Out
fn tanh(self) -> <Number as Trigonometry>::Out
Hyperbolic tangent
sourceimpl TryCastFrom<Value> for Number
impl TryCastFrom<Value> for Number
sourcefn can_cast_from(value: &Value) -> bool
fn can_cast_from(value: &Value) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(value: Value) -> Option<Self>
fn opt_cast_from(value: Value) -> Option<Self>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
impl Copy for Number
impl Eq for Number
impl StructuralEq for Number
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> Match for F
impl<F> Match for F
sourcefn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
fn matches<T>(&self) -> bool where
T: TryCastFrom<Self>,
Returns true
if self
can be cast into the target type T
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for T where
T: CastFrom<F>,
sourcefn can_cast_from(&F) -> bool
fn can_cast_from(&F) -> bool
Test if value
can be cast into Self
.
sourcefn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
sourcefn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
sourceimpl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for F where
T: TryCastFrom<F>,
sourcefn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if self
can be cast into T
.
sourcefn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns Some(T)
if self
can be cast into T
, otherwise None
.
sourcefn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.