pub trait Roundwhere
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§
Sourcefn round(self, n_frac_digits: i8) -> Self
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.
Sourcefn checked_round(self, n_frac_digits: i8) -> Option<Self>
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", so this trait is not object safe.