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

Add Default macro for non-exhaustive types #92

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

mmynk
Copy link
Contributor

@mmynk mmynk commented Jan 29, 2024

Adding Default macros for a subset of the non_exhaustive structs.

Need this in order to write unit tests when using this library. Without Default macro, creating this struct is extremely tedious. We cannot use struct expression to create them as it results in the below error:

error[E0639]: cannot create non-exhaustive struct using struct expression

It might be worthwhile to consider if the lib should drop #[non_exhaustive] macro altogether because I do not know if the macro is a right choice for a public facing library 1 2.

Copy link
Member

@cathay4t cathay4t left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (fb497b3) 64.20% compared to head (a54bea8) 64.20%.

Files Patch % Lines
src/tc/qdiscs/fq_codel.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #92   +/-   ##
=======================================
  Coverage   64.20%   64.20%           
=======================================
  Files         140      140           
  Lines        8947     8947           
=======================================
  Hits         5744     5744           
  Misses       3203     3203           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cathay4t
Copy link
Member

Regarding the non_exhaustive, I am open to suggestions if you have better approach on stabilizing our API when we or kernel add more items or struct or enum.

@cathay4t cathay4t merged commit e21122e into rust-netlink:main Jan 30, 2024
10 checks passed
@mmynk mmynk deleted the defaults branch January 30, 2024 16:10
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.

2 participants