pub trait TryTruncateInto<T, E> {
// Required method
fn try_truncate_into(self) -> Result<T, E>;
}Expand description
Convert one type to another by rounding to the nearest integer towards zero.
§Errors
Traps when the input float cannot be represented by the target integer or when the input float is NaN.
Required Methods§
Sourcefn try_truncate_into(self) -> Result<T, E>
fn try_truncate_into(self) -> Result<T, E>
Convert one type to another by rounding to the nearest integer towards zero.
§Errors
- If the input float value is NaN (not a number).
- If the input float value cannot be represented using the truncated integer type.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".