pub enum Rounding {
HalfEven,
HalfUp,
HalfDown,
Down,
Up,
}Expand description
Rounding represents the different strategies that can be used.
Rounding::HalfEven - Rounds toward the nearest even number, e.g. 5.5 -> 6, 4.5 -> 4
Rounding::HalfUp - Rounds up if the value >= 5, otherwise rounds down, e.g. 6.5 -> 7 (default),
Rounding::HalfDown - Rounds down if the value =< 5, otherwise rounds up, e.g.
4.5 -> 4, 4.51 -> 5, 1.4999 -> 1
Rounding::Down - Always round down.
Rounding::Up - Always round up.
Variants§
HalfEven
Rounds toward the nearest even number, e.g. 5.5 -> 6, 4.5 -> 4
HalfUp
Rounds up if the value >= 5, otherwise rounds down, e.g. 6.5 -> 7 (default)
HalfDown
Rounds down if the value <= 5, otherwise rounds up, e.g. 4.5 -> 4, 4.51 -> 5
Down
Always rounds down.
Up
Always rounds up.
Trait Implementations§
impl Copy for Rounding
impl Eq for Rounding
impl StructuralPartialEq for Rounding
Auto Trait Implementations§
impl Freeze for Rounding
impl RefUnwindSafe for Rounding
impl Send for Rounding
impl Sync for Rounding
impl Unpin for Rounding
impl UnsafeUnpin for Rounding
impl UnwindSafe for Rounding
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