Trait FromF64Approx

Source
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§

Source

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.

Implementations on Foreign Types§

Source§

impl FromF64Approx for f32

Source§

impl FromF64Approx for f64

Source§

impl FromF64Approx for i8

Source§

impl FromF64Approx for i16

Source§

impl FromF64Approx for i32

Source§

impl FromF64Approx for i64

Source§

impl FromF64Approx for u8

Source§

impl FromF64Approx for u16

Source§

impl FromF64Approx for u32

Source§

impl FromF64Approx for u64

Implementors§