#[non_exhaustive]pub enum AllNumbers<N: Number> {
Integer(AllIntegers),
Rational(AllRationals),
Any(N),
}Expand description
The family of any kind of number, also known as AllN.
§Notes
Note that it wont have several specific traits implemented, like for
example Zero or NonZero,
since they are mutually exclusive, and don’t apply to all cases.
The Numbers alias is more convenient to use unless you need to
refer to custom numbers via the Any variant.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Trait Implementations§
Source§impl<N: Number> Bound for AllNumbers<N>
This implementation defers to the actual number variant.
impl<N: Number> Bound for AllNumbers<N>
This implementation defers to the actual number variant.
Source§fn is_lower_bounded(&self) -> bool
fn is_lower_bounded(&self) -> bool
Returns true if the number is lower bounded.
Source§fn is_upper_bounded(&self) -> bool
fn is_upper_bounded(&self) -> bool
Returns true if the number is upper bounded.
Source§fn lower_bound(&self) -> Option<Self>
fn lower_bound(&self) -> Option<Self>
Returns the lower bound, if any.
Source§fn upper_bound(&self) -> Option<Self>
fn upper_bound(&self) -> Option<Self>
Returns the upper bound, if any.
Source§impl<N: Clone + Number> Clone for AllNumbers<N>
impl<N: Clone + Number> Clone for AllNumbers<N>
Source§fn clone(&self) -> AllNumbers<N>
fn clone(&self) -> AllNumbers<N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<N: Number> Count for AllNumbers<N>
This implementation defers to the actual number variant.
impl<N: Number> Count for AllNumbers<N>
This implementation defers to the actual number variant.
Source§fn is_countable(&self) -> bool
fn is_countable(&self) -> bool
Returns
true if the number is countable.Source§fn is_uncountable(&self) -> bool
fn is_uncountable(&self) -> bool
Returns
false if the number is countable.Source§impl<N: Number> From<AllIntegers> for AllNumbers<N>
impl<N: Number> From<AllIntegers> for AllNumbers<N>
Source§fn from(n: AllIntegers) -> AllNumbers<N>
fn from(n: AllIntegers) -> AllNumbers<N>
Converts to this type from the input type.
Source§impl<N: Number> From<AllRationals> for AllNumbers<N>
impl<N: Number> From<AllRationals> for AllNumbers<N>
Source§fn from(n: AllRationals) -> AllNumbers<N>
fn from(n: AllRationals) -> AllNumbers<N>
Converts to this type from the input type.
Source§impl<N: Number> Ident for AllNumbers<N>
This implementation defers to the actual number variant.
impl<N: Number> Ident for AllNumbers<N>
This implementation defers to the actual number variant.
Source§fn can_neg_one(&self) -> bool
fn can_neg_one(&self) -> bool
Returns
true if the number can represent -1,
the additive inverse of the multiplicative identity. Read moreSource§fn is_neg_one(&self) -> bool
fn is_neg_one(&self) -> bool
Returns
true if the current value is -1,
the additive inverse of the multiplicative identity.Source§impl<N: Number> Number for AllNumbers<N>
This implementation is no-op.
impl<N: Number> Number for AllNumbers<N>
This implementation is no-op.
Source§fn from_inner_repr(value: Self) -> NumeraResult<Self>
fn from_inner_repr(value: Self) -> NumeraResult<Self>
Returns value unchanged.
Source§unsafe fn from_inner_repr_unchecked(value: AllNumbers<N>) -> Self
Available on crate feature not(safe) only.
unsafe fn from_inner_repr_unchecked(value: AllNumbers<N>) -> Self
not(safe) only.Returns value unchanged.
Source§fn from_innermost_repr(value: Self) -> NumeraResult<Self>
fn from_innermost_repr(value: Self) -> NumeraResult<Self>
Returns value unchanged.
Source§unsafe fn from_innermost_repr_unchecked(value: Self) -> Self
Available on crate feature not(safe) only.
unsafe fn from_innermost_repr_unchecked(value: Self) -> Self
not(safe) only.Source§fn into_inner_repr(self) -> Self::InnerRepr
fn into_inner_repr(self) -> Self::InnerRepr
Returns self.
Source§fn into_innermost_repr(self) -> Self::InnermostRepr
fn into_innermost_repr(self) -> Self::InnermostRepr
Returns self.
Source§type InnerRepr = AllNumbers<N>
type InnerRepr = AllNumbers<N>
The inner primitive representation of the number. Read more
Source§type InnermostRepr = AllNumbers<N>
type InnermostRepr = AllNumbers<N>
The innermost primitive representation of the number. Read more
Source§fn try_from_inner_repr(inner: impl Into<Self::InnerRepr>) -> NumeraResult<Self>where
Self: Sized,
fn try_from_inner_repr(inner: impl Into<Self::InnerRepr>) -> NumeraResult<Self>where
Self: Sized,
Forms a new number from its converted given
inner representation. Read moreSource§impl<N: Number> Sign for AllNumbers<N>
This implementation defers to the actual number variant.
impl<N: Number> Sign for AllNumbers<N>
This implementation defers to the actual number variant.
Source§fn can_positive(&self) -> bool
fn can_positive(&self) -> bool
Returns
true if the type can represent positive numbers.Source§fn can_negative(&self) -> bool
fn can_negative(&self) -> bool
Returns
true if the type can represent negative numbers.Source§fn is_positive(&self) -> bool
fn is_positive(&self) -> bool
Returns
true if the value is positive (> 0).Source§fn is_negative(&self) -> bool
fn is_negative(&self) -> bool
Returns
true if the value is negative (< 0).Source§impl<N: Number> TryFrom<AllNumbers<N>> for AllIntegers
impl<N: Number> TryFrom<AllNumbers<N>> for AllIntegers
Source§type Error = NumeraErrors
type Error = NumeraErrors
The type returned in the event of a conversion error.
Source§fn try_from(n: AllNumbers<N>) -> Result<AllIntegers, Self::Error>
fn try_from(n: AllNumbers<N>) -> Result<AllIntegers, Self::Error>
Performs the conversion.
Source§impl<N: Number> TryFrom<AllNumbers<N>> for AllRationals
impl<N: Number> TryFrom<AllNumbers<N>> for AllRationals
Source§type Error = NumeraErrors
type Error = NumeraErrors
The type returned in the event of a conversion error.
Source§fn try_from(n: AllNumbers<N>) -> Result<AllRationals, Self::Error>
fn try_from(n: AllNumbers<N>) -> Result<AllRationals, Self::Error>
Performs the conversion.
impl<N: Number> StructuralPartialEq for AllNumbers<N>
Auto Trait Implementations§
impl<N> Freeze for AllNumbers<N>where
N: Freeze,
impl<N> RefUnwindSafe for AllNumbers<N>where
N: RefUnwindSafe,
impl<N> Send for AllNumbers<N>where
N: Send,
impl<N> Sync for AllNumbers<N>where
N: Sync,
impl<N> Unpin for AllNumbers<N>where
N: Unpin,
impl<N> UnwindSafe for AllNumbers<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> Also for T
impl<T> Also for T
Source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.