pub trait DecimalConvert: DecimalArithmetic {
// Required methods
fn from_bits(raw: Self::Storage) -> Self;
fn to_bits(self) -> Self::Storage;
fn scale(self) -> u32;
fn from_i32(value: i32) -> Self;
fn to_int(self) -> i64;
fn to_int_with(self, mode: RoundingMode) -> i64;
fn from_f64(value: f64) -> Self;
fn from_f64_with(value: f64, mode: RoundingMode) -> Self;
fn to_f64(self) -> f64;
fn to_f32(self) -> f32;
}Expand description
Round-trip + conversion surface shared by every decimal width.
Supertraits DecimalArithmetic so the storage type and
boundary constants are accessible for saturation logic.
Required Methods§
Sourcefn to_int_with(self, mode: RoundingMode) -> i64
fn to_int_with(self, mode: RoundingMode) -> i64
Convert to i64 using the supplied rounding mode.
Sourcefn from_f64_with(value: f64, mode: RoundingMode) -> Self
fn from_f64_with(value: f64, mode: RoundingMode) -> Self
Construct from f64 using the supplied rounding mode.
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.