pub enum RoundMode {
    Down,
    Up,
    HalfUp,
    HalfDown,
}
Expand description

as a decimal value. There are four rounding modes currently supported.

Variants

Down

Truncates the value toward zero.

For example, 12.009 to 2 decimal places becomes 12.00.

Up

Rounds the value away from zero.

For example, 12.001 to 2 decimal places becomes 12.01, but 12.000 to 2 decimal places remains 12.00.

HalfUp

Rounds the value to nearest digit, half rounds upward.

For example, 12.005 to 2 decimal places becomes 12.01, but 12.004 to 2 decimal places becomes 12.00.

HalfDown

Rounds the value to nearest digit, half goes toward zero.

For example, 12.005 to 2 decimal places becomes 12.00, but 12.006 to 2 decimal places becomes 12.01.

Trait Implementations

Converts this type into the (usually inferred) input type.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.