pub trait FloatConversion {
    type Float;

    // Required methods
    fn into_float(self) -> Self::Float;
    fn from_float(float: Self::Float) -> Self;
}
Expand description

Converts a type to its floating point representation.

This trait exists because there is no trait in Rust to peform x as f32.

Required Associated Types§

source

type Float

The type that represents this type in floating point form.

Required Methods§

source

fn into_float(self) -> Self::Float

Returns this value in floating point form.

source

fn from_float(float: Self::Float) -> Self

Converts from floating point to this form.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FloatConversion for i32

§

type Float = f32

source§

fn into_float(self) -> Self::Float

source§

fn from_float(float: Self::Float) -> Self

source§

impl FloatConversion for u32

§

type Float = f32

source§

fn into_float(self) -> Self::Float

source§

fn from_float(float: Self::Float) -> Self

Implementors§