Trait TryTruncateFrom

Source
pub trait TryTruncateFrom<T>: Sized {
    // Required method
    fn try_truncate_from(value: T) -> Option<Self>;
}

Required Methods§

Source

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.

Implementors§

Source§

impl<Source, Dest> TryTruncateFrom<Source> for Dest
where Source: TryTruncate<Dest>,