-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add serde
for BoxedUInt
#587
base: master
Are you sure you want to change the base?
Conversation
src/uint/boxed.rs
Outdated
#[cfg(feature = "serde")] | ||
impl<'de> Deserialize<'de> for BoxedUint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoding-related functionality should go under https://github.com/RustCrypto/crypto-bigint/blob/master/src/uint/boxed/encoding.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks done
D: Deserializer<'de>, | ||
{ | ||
let mut buffer = Self::zero().to_le_bytes(); | ||
serdect::array::deserialize_hex_or_bin(buffer.as_mut(), deserializer)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't work because it doesn't know the size and zero() doesn't size it for the incoming buf
Having some weird errors from the alloc variant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to use serdect::slice
if the size isn't known a priori
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I thought I tried (the alloc variant) that and it gave some weird runtime behaviour
@tarcieri @pinkforest what's the state here? |
The feedback I left hasn't been addressed and the tests aren't yet all passing |
Please anyone feel free to cherry on my commit and fix - I got stuck with the alloc version playing up weird. |
Missing impl
Serialize
andDeserialize