Trait mz_ore::cast::CastLossy

source ·
pub trait CastLossy<T> {
    // Required method
    fn cast_lossy(from: T) -> Self;
}
Expand description

A trait for potentially-lossy casts. Typically useful when converting from integers to floating point, and you want the nearest floating-point number to your integer when your integer is large, or vice versa.

Required Methods§

source

fn cast_lossy(from: T) -> Self

Perform the lossy cast.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CastLossy<f64> for i64

source§

impl CastLossy<f64> for u32

source§

impl CastLossy<f64> for u64

source§

impl CastLossy<f64> for usize

source§

impl CastLossy<i64> for f64

source§

impl CastLossy<isize> for f64

source§

impl CastLossy<u64> for f64

source§

impl CastLossy<usize> for f64

Implementors§