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

serde: add support for some of the alloc collections #253

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

hackaugusto
Copy link
Contributor

@hackaugusto hackaugusto commented Feb 28, 2024

This adds a generic implementation of the traits Serializable and Deserializable for the following types:

  • Vec
  • BTreeMap
  • BTreeSet

Unfortunately I couldn't use IntoIterator because that would conflict with the existing generic implementation for tuples, and the issue can not be solved without trait specialization

Comment on lines +421 to +422
let data = source.read_many(len)?;
Ok(BTreeSet::from_iter(data))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the moment the copy is required, since there is no iterator API for theByteReader

Copy link
Collaborator

@irakliyk irakliyk left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@irakliyk irakliyk merged commit 2e324e2 into facebook:main Feb 29, 2024
9 checks passed
@hackaugusto hackaugusto deleted the hacka-support-alloc-collections branch February 29, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants