pub trait TryTruncate<T> {
// Required method
fn try_truncate(self) -> Option<T>;
}
Required Methods§
Sourcefn try_truncate(self) -> Option<T>
fn try_truncate(self) -> Option<T>
Try to truncate an integer to fit into a smaller type.
If the value fits into the target type, return Ok(value)
Otherwise, return None
.