Trait num_convert::FromAs
source · pub trait FromAs<T> {
// Required method
fn from_as(n: T) -> Self;
}Expand description
The FromAs generic trait for convert from value between integer types with possible overflow.
Examples
Usage:
assert_eq!(<u8>::from_as(258u16), 2u8);
assert_eq!(<u8 as FromAs<u16>>::from_as(255u16), 255u8);