hex-macro

Crates.iohex-macro
lib.rshex-macro
version0.1.0
sourcesrc
created_at2024-06-03 15:25:43.371901
updated_at2024-06-03 15:25:43.371901
descriptionAdds a hex! macro for compile-time hex decoding
homepage
repositoryhttps://github.com/ozgb/hex-macro
max_upload_size
id1260210
size4,286
Oscar Bailey (ozgb)

documentation

README

hex-macro

Crates.io Documentation License

hex-macro is a Rust crate that provides a hex! macro for compile-time hex decoding.

use hex_macro::hex;

pub const DATA: [u8; 11] = hex!("0x48656c6c6f20776f726c64"); // Also works without the '0x' prefix
assert_eq!(DATA, *b"Hello world");

Features

  • Decodes hex strings into byte arrays at compile time.
  • Supports hex strings with and without the 0x prefix.

Installation

Add this to your Cargo.toml:

[dependencies]
hex-macro = "0.1.0"

TODO

  • Add support for other decoding backends using feature flags

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Commit count: 3

cargo fmt