Enum dec::Rounding[][src]

pub enum Rounding {
    Ceiling,
    Down,
    Floor,
    HalfDown,
    HalfEven,
    HalfUp,
    Up,
    ZeroFiveUp,
}

Algorithms for rounding decimal numbers.

The rounding modes are precisely defined in The Arithmetic Model chapter of the General Decimal Arithmetic specification.

Variants

Ceiling

Round towards positive infinity.

Down

Round towards zero (truncation).

Floor

Round towards negative infinity.

HalfDown

Round to nearest; if equidistant, round down.

HalfEven

Round to nearest; if equidistant, round so that the final digit is even.

HalfUp

Round to nearest; if equidistant, round up.

Up

Round away from zero.

ZeroFiveUp

The same as Rounding::Up, except that rounding up only occurs if the digit to be rounded up is 0 or 5.

After overflow the result is the same as for Rounding::Down.

Trait Implementations

impl Clone for Rounding[src]

impl Copy for Rounding[src]

impl Debug for Rounding[src]

impl Default for Rounding[src]

impl Eq for Rounding[src]

impl PartialEq<Rounding> for Rounding[src]

impl StructuralEq for Rounding[src]

impl StructuralPartialEq for Rounding[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.