pub trait FromF64Approx: Sized {
// Required method
fn from_f64_approx(v: f64) -> Option<Self>;
}Expand description
Helper trait for converting f64 to integer types.
Required Methods§
Sourcefn from_f64_approx(v: f64) -> Option<Self>
fn from_f64_approx(v: f64) -> Option<Self>
Constructs an integer type from a f64.
Implementors must satisfy two invariants:
- For input values in range of the output type, return the closest value.
- For input values outside the range of the output type, return
None.
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.