Struct num_decimal::Num32
source · [−]pub struct Num32(_);
Expand description
A fixed size number type with some improvements and customizations
over Rational32
.
Please note that this type is meant to be used mostly in scenarios
where memory boundedness is of paramount importance. Importantly,
it does not constitute a fully blown replacement for Num
, as
the provided functionality is much more limited (and likely will
never catch up completely).
Implementations
sourceimpl Num32
impl Num32
sourcepub fn approximate(num: Num) -> Self
pub fn approximate(num: Num) -> Self
Approximate a Num
with a Num32
.
This constructor provides a potentially lossy way of creating a
Num32
that approximates the provided Num
.
If you want to make sure that no precision is lost (and fail if
this constraint cannot be upheld), then usage of
Num32::try_from
is advised.
Trait Implementations
sourceimpl Ord for Num32
impl Ord for Num32
sourceimpl PartialOrd<Num32> for Num32
impl PartialOrd<Num32> for Num32
sourcefn partial_cmp(&self, other: &Num32) -> Option<Ordering>
fn partial_cmp(&self, other: &Num32) -> 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
impl Copy for Num32
impl Eq for Num32
impl StructuralEq for Num32
impl StructuralPartialEq for Num32
Auto Trait Implementations
impl RefUnwindSafe for Num32
impl Send for Num32
impl Sync for Num32
impl Unpin for Num32
impl UnwindSafe for Num32
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more