Skip to content

Allow byte literals in TryFromPrimitive alternatives#181

Merged
illicitonion merged 1 commit intoillicitonion:mainfrom
coolreader18:byte-alternative
Mar 15, 2026
Merged

Allow byte literals in TryFromPrimitive alternatives#181
illicitonion merged 1 commit intoillicitonion:mainfrom
coolreader18:byte-alternative

Conversation

@coolreader18
Copy link
Copy Markdown
Contributor

Useful for when the values correspond to ascii codepoints, it's more self-explanatory to put b'A' than 0x41.

Copy link
Copy Markdown
Owner

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, I think it makes a lot of sense.

Please can you add a test to https://github.com/illicitonion/num_enum/blob/main/num_enum/tests/try_from_primitive.rs showing this works?

Also if you merge main / rebase the failing existing test should start passing again :)

Thanks!

@coolreader18
Copy link
Copy Markdown
Contributor Author

Oh whoops, I added a test but I guess I forgot to push.

Copy link
Copy Markdown
Owner

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Thanks!

@illicitonion illicitonion merged commit 40e822b into illicitonion:main Mar 15, 2026
7 checks passed
@illicitonion
Copy link
Copy Markdown
Owner

Released as 0.7.6 - thanks again!

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