macro_rules! to_byte_array {
    ($s: expr) => { ... };
}
Expand description

Converts a string slice or a byte string to a byte array.

§Examples

const S: &str = "hello";
const B: &[u8; 6] = b"hello\0";
assert_eq!(const_str::to_byte_array!(S), [b'h', b'e', b'l', b'l', b'o']);
assert_eq!(const_str::to_byte_array!(B), [b'h', b'e', b'l', b'l', b'o', b'\0']);