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.
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.