Skip to content
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

feature: bytes handles numeric arrays and bytearrays in deser #202

Merged
merged 6 commits into from
Jul 25, 2023

Conversation

prestwich
Copy link
Member

@prestwich prestwich commented Jul 20, 2023

closes #198

Motivation

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@prestwich prestwich added the enhancement New feature or request label Jul 20, 2023
@prestwich prestwich self-assigned this Jul 20, 2023
@prestwich
Copy link
Member Author

Gave the same treatment to Bytes as well

@prestwich prestwich marked this pull request as ready for review July 21, 2023 19:44
Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll implement these rq

Comment on lines +62 to +66
hex::decode(v)
.map_err(|_| {
de::Error::invalid_value(de::Unexpected::Str(v), &"a valid hex string")
})
.map(From::from)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hex::decode(v)
.map_err(|_| {
de::Error::invalid_value(de::Unexpected::Str(v), &"a valid hex string")
})
.map(From::from)
v.parse()
.map_err(|_| {
de::Error::invalid_value(de::Unexpected::Str(v), &"a valid hex string")
})

where
A: serde::de::SeqAccess<'de>,
{
let mut bytes = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DaniPopes DaniPopes merged commit 0cd5243 into main Jul 25, 2023
@DaniPopes DaniPopes deleted the prestwich/serde-number-and-bytes branch July 25, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Allow Bytes deserialization to accept arrays of u8
2 participants