pub trait TryTruncateFrom<T>: Sized {
// Required method
fn try_truncate_from(value: T) -> Option<Self>;
}Required Methods§
Sourcefn try_truncate_from(value: T) -> Option<Self>
fn try_truncate_from(value: T) -> Option<Self>
Try to truncate an integer to fit into a smaller type.
If the value fits into the Self type, return Ok(value)
Otherwise, return None.
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.