std::bytes!
[-]
[+]
[src]
macro_rules! bytes { ($($e:expr),*) => ({ /* compiler built-in */ }) }
Concatenate literals into a static byte slice.
This macro takes any number of comma-separated literal expressions,
yielding an expression of type &'static [u8]
which is the
concatenation (left to right) of all the literals in their byte format.
This extension currently only supports string literals, character literals, and integers less than 256. The byte slice returned is the utf8-encoding of strings and characters.
Example
fn main() { let rust = bytes!("r", 'u', "st", 255); assert_eq!(rust[1], b'u'); assert_eq!(rust[4], 255); }let rust = bytes!("r", 'u', "st", 255); assert_eq!(rust[1], b'u'); assert_eq!(rust[4], 255);