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

Change defaults #68

Merged
merged 4 commits into from
Mar 24, 2024
Merged

Change defaults #68

merged 4 commits into from
Mar 24, 2024

Conversation

mjhouse
Copy link
Owner

@mjhouse mjhouse commented Mar 24, 2024

This PR will close #63 and #49

Main changes

  • Changed the defaults of all flag enums to essentially truncate given values rather than default to whichever variant has a value of 0. So parsing a u8 with a value of 0b11 into a TransmitReceive enum will truncate to 1, which is the Transmit variant. Originally, this would have defaulted to Receive, which has a value of 0.
  • Removed the Unknown variants from Address and SubAddress because they don't serve a purpose when parsing (the value being parsed from the message will always be 5 bits wide) and make usage confusing when the addresses are constructed by users of the library.

Other changes

  • Removed derive as a default feature flag
  • Added explicit example config in toml
  • Added required feature flag derive for custom example
  • Changed get to at
  • Changed get_as to get
  • Changed old unused_tuple_struct_fields lint to dead_code
  • Updated examples to accommodate changes
  • Improved code coverage
  • Added a few missing must_use declarations on is_ methods

Copy link
Contributor

github-actions bot commented Mar 24, 2024

Coverage

File Coverage
All files 100%
src/message/packets.rs 100%
src/errors.rs 100%
src/word/words.rs 100%
src/fields.rs 100%
src/message/messages.rs 100%
src/word/enums.rs 100%
src/flags.rs 100%

Minimum allowed coverage is 95%

Generated by 🐒 cobertura-action against 8996833

@mjhouse mjhouse merged commit 40cae9c into development Mar 24, 2024
17 checks passed
@mjhouse mjhouse deleted the change_defaults branch March 24, 2024 14:09
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.

Investigate changing defaults of flag enums
1 participant