parity-common icon indicating copy to clipboard operation
parity-common copied to clipboard

[uint] Implement From trait for conversions that can't fail

Open charlesndalton opened this issue 3 years ago • 0 comments

It would be nice to have the From trait implemented for conversions that can't fail, such as U64 -> u64.

// Today
let a: u64 = U64::MAX.try_into().unwrap();
let b: u128 = U128::MAX.try_into().unwrap();

// Requested
let x: u64 = U64::MAX.into();
let y: u128 = U128::MAX.into();
let z: u128 = U64::MAX.into();

charlesndalton avatar Jul 19 '22 00:07 charlesndalton