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

deer: implement Deserialize for tuples #2418

Merged
merged 7 commits into from
Apr 28, 2023
Merged

deer: implement Deserialize for tuples #2418

merged 7 commits into from
Apr 28, 2023

Conversation

indietyp
Copy link
Member

@indietyp indietyp commented Apr 13, 2023

🌟 What is the purpose of this PR?

Implements Deserialize for tuples of up to 16 items (like axum), originally taken from #1875, because there is no variadic support for tuples just yet (or even ever? D:) this is quite macro-heavy code.

Stats:

  • serde: up to 16 elements
  • proptest: up to 9 elements
  • builtin: up to 12 elements for PartialEq, Eq, PartialOrd, Debug, Default, Hash, other built-in traits are infinite.
  • deer: up to 16 elements
  • axum: up to 16 elements

To facilitate proper error handling a temporary trait TupleExt has been added, once #2377 has been resolved a more long-term solution will be implemented.

🔗 Related links

🚀 Has this modified a publishable library?

This PR:

  • modifies an npm-publishable library and I have added a changeset file(s)
  • modifies a Cargo-publishable library and I have amended the version
  • modifies a Cargo-publishable library, but it is not yet ready to publish
  • modifies a block that will need publishing via GitHub action once merged
  • does not modify any publishable blocks or libraries
  • I am unsure / need advice

@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #2418 (6dcf636) into main (1308828) will increase coverage by 0.68%.
The diff coverage is 67.34%.

@@            Coverage Diff             @@
##             main    #2418      +/-   ##
==========================================
+ Coverage   56.32%   57.00%   +0.68%     
==========================================
  Files         338      342       +4     
  Lines       26248    26085     -163     
  Branches      384      421      +37     
==========================================
+ Hits        14784    14871      +87     
+ Misses      11463    11209     -254     
- Partials        1        5       +4     
Flag Coverage Δ
deer 68.93% <67.34%> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
libs/deer/src/lib.rs 73.80% <ø> (ø)
libs/deer/src/impls/core/tuples.rs 63.63% <63.63%> (ø)
libs/deer/src/ext.rs 75.00% <75.00%> (ø)

... and 33 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@thehabbos007 thehabbos007 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 to me. Realized i forgot to submit this review weeks ago :)

}

#[rustfmt::skip]
macro_rules! all_the_tuples {
Copy link
Contributor

Choose a reason for hiding this comment

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

tuples all the way down

Comment on lines +45 to +47
Schema::new("array")
.with("prefixItems", [$(doc.add::<$elem>()),*])
.with("items", false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice to see this conform to the newest draft 👍

@indietyp indietyp enabled auto-merge April 28, 2023 11:18
@indietyp indietyp added this pull request to the merge queue Apr 28, 2023
Merged via the queue into main with commit 46c5058 Apr 28, 2023
@indietyp indietyp deleted the bm/deer/core-tuples branch April 28, 2023 11:52
CiaranMn pushed a commit that referenced this pull request Apr 28, 2023
* feat: glue helper trait `TupleExt`

* feat: take code from #1875 and fix

* test: array impl

* fix: miri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/libs > deer Affects the `deer` crate (library)
Development

Successfully merging this pull request may close these issues.

None yet

2 participants