Skip to content

Add hex_bytes! macro to interpret string literals as hex strings #14573

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

Closed
wants to merge 1 commit into from

Conversation

apoelstra
Copy link
Contributor

When testing network serialization routines for a recent project, I found it would be very useful for readability's sake to have a way to write [u8, ..N] byte arrays as hexadecimal strings. This patch introduces the hex_bytes! macro for this purpose.

@alexcrichton
Copy link
Member

We're trying to keep the number of macros hard-wired into the compiler as small as possible now that we have an infrastructure for dynamically loading syntax extensions at compile time. If this is added, it should be added as a library outside of the compiler.

That being said, this use case seems similar to the use case of the fourcc and hexfloat crates, which are really crates that want to be managed by cargo, so this may be best waiting until cargo exists to be able to officially distribute it easily.

@alexcrichton
Copy link
Member

Closing due to inactivity, but I think this my belong well in a separate library!

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
internal: Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData
bors pushed a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
…lang#14573)

`non_canonical_partial_ord_impl` will now recognize two forms of
canonical implementations: `Some(self.cmp(other))` and
`self.cmp(other).into()`.

changelog: [`non_canonical_partial_ord_impl`]: recognize
`self.cmp(other).into()` as a canonical implementation of
`PartialOrd::partial_cmp()`.

Fixes rust-lang/rust-clippy#13640
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