macro_rules! cstr8 { () => { ... }; ($s:literal) => { ... }; }
Expand description
Encode a string literal as a &CStr8
.
The encoding is done at compile time, so the result can be used in a
const
item.
An empty string containing just a null character can be created with either
cstr8!()
or cstr8!("")
.
§Example
use uefi::{CStr8, cstr8};
const S: &CStr8 = cstr8!("abÿ");
assert_eq!(S.as_bytes(), [97, 98, 255, 0]);
const EMPTY: &CStr8 = cstr8!();
assert_eq!(EMPTY.as_bytes(), [0]);
assert_eq!(cstr8!(""), EMPTY);