macro_rules! bytes { () => { ... }; ($($s:literal)+) => { ... }; [$($inner:literal),+ $(,)?] => { ... }; [$inner:literal; $size:literal] => { ... }; }
Expand description
Converts a sequence of string literals containing hex-encoded data into a
new Bytes
at compile time.
If the input is empty, an empty instance is returned.
Note that the strings cannot be prefixed with 0x
.
See hex!
for more information.
ยงExamples
use alloy_primitives::{bytes, Bytes};
static MY_BYTES: Bytes = bytes!("0123abcd");
assert_eq!(MY_BYTES, Bytes::from(&[0x01, 0x23, 0xab, 0xcd]));