pub struct Num32(/* private fields */);
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§
Source§impl 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§
Source§impl Ord for Num32
impl Ord for Num32
Source§impl PartialOrd for Num32
impl PartialOrd for Num32
impl Copy for Num32
impl Eq for Num32
impl StructuralPartialEq for Num32
Auto Trait Implementations§
impl Freeze for Num32
impl RefUnwindSafe for Num32
impl Send for Num32
impl Sync for Num32
impl Unpin for Num32
impl UnwindSafe for Num32
Blanket Implementations§
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