Add impl to converto from U256 to [u8; 32]

This commit is contained in:
David Palm 2018-08-13 15:54:21 +02:00
parent 97ecf175c8
commit d3c335e7f7
1 changed files with 9 additions and 1 deletions

View File

@ -1369,4 +1369,12 @@ macro_rules! impl_quickcheck_arbitrary_for_uint {
}
construct_uint!(U256, 4);
construct_uint!(U512, 8);
construct_uint!(U512, 8);
impl From<U256> for [u8; 32] {
fn from(number: U256) -> Self {
let mut arr = [0u8; 32];
number.to_big_endian(&mut arr);
arr
}
}