-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Either support parsing to/from U256/I256 or remove the variants #8
Comments
I can probably do you a fast U256 string parser if you want one. Pretty sure I have the fastest U128 parser at the moment ( https://github.com/gilescope/atoi_radix10 ) not that anyone has really made use of it yet. |
String parsing to/from U256/I256 would be awesome and would resolve the annoying to_string panic on U256s, so I'd def be up for such things, especially if it was light or no dependencies :) |
(I wonder whether something like https://www.reddit.com/r/rust/comments/vwtfd7/announcing_a_new_big_integer_crate_bnum_which/ would be useful at all, or generally how the current crates compare, but yeah being light on dependencies is important for this crate!) |
We'll likely end up removing the 256bit scale types; see paritytech/scale-info#181 |
Currently we support decoding and encoding into U256/I256 variants, but both are just represented as arrays of bytes.
Serializing values containing U256/I256's via serde isn't great; they serialize into byte sequences. Deserializing those leaves you with composites; no deserialize input can get out U256/I256; so unlike other types, they don't convert back and forth nicely.
With #7 we cannot yet stringify U256/I256 and we cannot parse strings into them. Parsing isn't as important (we get back a nice error if a numeric string is too big to fit U128/I128) but calling
.to_string()
on a value containing a U256/I258 will panic. Whatever we stringify should be parsable back again, so we need to add both or neither.So, do we:
TypeInfo
impls they will never be seen in metadata.The text was updated successfully, but these errors were encountered: