Skip to main content

Round

Trait Round 

Source
pub trait Round
where Self: Sized,
{ // Required methods fn round(self, n_frac_digits: i8) -> Self; fn checked_round(self, n_frac_digits: i8) -> Option<Self>; }
Expand description

Rounding a number to a given number of fractional digits.

Required Methods§

Source

fn round(self, n_frac_digits: i8) -> Self

Returns a new Self instance with its value rounded to n_frac_digits fractional digits according to the current RoundingMode.

Source

fn checked_round(self, n_frac_digits: i8) -> Option<Self>

Returns a new Self instance with its value rounded to n_frac_digits fractional digits according to the current RoundingMode, wrapped in Option::Some, or Option::None if the result can not be represented by Self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§