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§
sourcefn cast_lossy(from: T) -> Self
fn cast_lossy(from: T) -> Self
Perform the lossy cast.
Object Safety§
This trait is not object safe.