Trait tiny_skia_path::SaturateCast
source · [−]pub trait SaturateCast<T>: Sized {
fn saturate_from(n: T) -> Self;
}Expand description
Custom float to integer conversion routines.
Required Methods
sourcefn saturate_from(n: T) -> Self
fn saturate_from(n: T) -> Self
Return the closest integer for the given float.
Implementations on Foreign Types
sourceimpl SaturateCast<f32> for i32
impl SaturateCast<f32> for i32
sourcefn saturate_from(x: f32) -> Self
fn saturate_from(x: f32) -> Self
Return the closest integer for the given float.
Returns MAX_I32_FITS_IN_F32 for NaN.
sourceimpl SaturateCast<f64> for i32
impl SaturateCast<f64> for i32
sourcefn saturate_from(x: f64) -> Self
fn saturate_from(x: f64) -> Self
Return the closest integer for the given double.
Returns i32::MAX for NaN.