macro_rules! hex_const {
($name:ident = $hex:expr) => { ... };
}
Available on crate feature
rust_v_1_46
only.Expand description
Creates a constant byte array of given name.
This is a convenience macro so that you don’t have to write out the type. However it is intentionally not public - public constants must be explicitly typed to avoid accidental change of the type.
Example
use hex_lit::hex_const;
// same as writing `const FOO: [u8; 2] = [0x00, 0xff];`
hex_const!(FOO = "00ff");
assert_eq!(FOO, [0, 255]);