Skip to content
This repository has been archived by the owner on Sep 19, 2019. It is now read-only.

Unify conversions to [u8] #4

Open
tomusdrw opened this issue Nov 14, 2017 · 0 comments
Open

Unify conversions to [u8] #4

tomusdrw opened this issue Nov 14, 2017 · 0 comments

Comments

@tomusdrw
Copy link
Contributor

tomusdrw commented Nov 14, 2017

Currently you can do Uint::to_big_endian(), but for hashes it's hash.0
Would be good to have a single way of doing such conversions.

Something to consider as well:

to_big_endian(&self) -> [u8; LEN]
copy_big_endian(&self, &mut [u8]);

It's kind of annoying to do:

let mut bytes = [0u8; 32];
uint.to_big_endian(&mut bytes);
bytes.to_vec()

each time you want to convert uint into bytes (for instance for custom serialization)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant