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

feat: Added support for BTreeMap, BTreeSet, BinaryHeap, LinkedList types #6

Merged
merged 3 commits into from
Jan 13, 2021

Conversation

frol
Copy link
Collaborator

@frol frol commented Jan 12, 2021

Resolves #5

@frol frol requested a review from ailisp as a code owner January 12, 2021 13:52
@frol frol changed the title feat: Added support for BTree*, BinaryHeap, LinkedList types feat: Added support for BTreeMap, BTreeSet, BinaryHeap, LinkedList types Jan 12, 2021
#[inline]
fn deserialize(buf: &mut &[u8]) -> Result<Self> {
let vec = <Vec<T>>::deserialize(buf)?;
Ok(vec.into_iter().collect::<LinkedList<T>>())
Copy link
Member

Choose a reason for hiding this comment

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

This code looks beautiful, however do we concern about avoid extra copy and convert cost, if we really want highest performance?

Copy link
Collaborator Author

@frol frol Jan 12, 2021

Choose a reason for hiding this comment

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

That is how HashSet was already implemented. I think we can have another round of writing a helper to deserialize into an iterator and thus optimize the performance and avoid duplicate code

Copy link
Member

@ailisp ailisp left a comment

Choose a reason for hiding this comment

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

Code looks good, but also consider add tests for newly added types?

borsh/src/ser/mod.rs Outdated Show resolved Hide resolved
@frol frol requested a review from ailisp January 12, 2021 17:49
Copy link
Member

@ailisp ailisp 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!

@frol frol merged commit 79cb443 into master Jan 13, 2021
@frol frol mentioned this pull request May 31, 2023
@frol frol deleted the feat/added-support-for-more-built-in-types branch June 2, 2023 20:03
@frol frol mentioned this pull request Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BTreeMap serialization missing in 0.8.0 update
2 participants