Macro bytes
macro_rules! bytes {
() => { ... };
($($s:literal)+) => { ... };
[$($inner:expr),+ $(,)?] => { ... };
[$inner:expr; $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.
See hex!
for more information.
ยงExamples
use alloy_primitives::{bytes, Bytes};
static MY_BYTES: Bytes = bytes!("0x0123" "0xabcd");
assert_eq!(MY_BYTES, Bytes::from(&[0x01, 0x23, 0xab, 0xcd]));