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 core::num #2378

Merged
merged 8 commits into from
Apr 13, 2023
Merged

deer: implement Deserialize for core::num #2378

merged 8 commits into from
Apr 13, 2023

Conversation

indietyp
Copy link
Member

@indietyp indietyp commented Apr 9, 2023

🌟 What is the purpose of this PR?

Implements Deserialize for:

  • core::num::Wrapping
  • core::num::Saturating

Orginally taken from #1875

🔗 Related links

👂 Open Questions

Should Wrapping and Saturating be considered at deserialization time? Currently we just deserialize the value with the underlying value and then map Wrapping onto it. We will still fail if we supply 256 to an u8. This is currently what serde does.

Alternative would be only to implement Wrapping on all primitive num types, and if a larger number is encountered we simply modulo it on wrapping or set it to the max.

🔍 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 9, 2023

Codecov Report

Merging #2378 (e96c08d) into main (3bf4fa1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2378   +/-   ##
=======================================
  Coverage   56.77%   56.78%           
=======================================
  Files         337      337           
  Lines       26015    26021    +6     
  Branches      421      421           
=======================================
+ Hits        14769    14775    +6     
  Misses      11241    11241           
  Partials        5        5           
Flag Coverage Δ
backend-integration-tests 3.66% <ø> (ø)
deer 69.29% <100.00%> (+0.04%) ⬆️
unit-tests 1.49% <ø> (ø)

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/num.rs 100.00% <100.00%> (ø)

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

Copy link
Member

@TimDiekmann TimDiekmann 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, but a few more test cases would be nice. I guess this won't be hard 🙂

libs/deer/tests/test_impls_core_num.rs Outdated Show resolved Hide resolved
TimDiekmann
TimDiekmann previously approved these changes Apr 13, 2023
TimDiekmann
TimDiekmann previously approved these changes Apr 13, 2023
@indietyp indietyp added this pull request to the merge queue Apr 13, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Apr 13, 2023
TimDiekmann
TimDiekmann previously approved these changes Apr 13, 2023
@indietyp indietyp added this pull request to the merge queue Apr 13, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 13, 2023
@indietyp indietyp added this pull request to the merge queue Apr 13, 2023
@indietyp indietyp removed this pull request from the merge queue due to a manual request Apr 13, 2023
@indietyp indietyp added this pull request to the merge queue Apr 13, 2023
Merged via the queue into main with commit e07a6cc Apr 13, 2023
@indietyp indietyp deleted the bm/deer/core-num branch April 13, 2023 21:29
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.

2 participants