Macro uefi_macros::cstr8

source ·
cstr8!() { /* proc-macro */ }
Expand description

Builds a CStr8 literal at compile time from a string literal.

This will throw a compile error if an invalid character is in the passed string.

Example

// Empty string
assert_eq!(cstr8!().to_u16_slice_with_nul(), [0]);
assert_eq!(cstr8!("").to_u16_slice_with_nul(), [0]);
// Non-empty string
assert_eq!(cstr8!("test").as_bytes(), [116, 101, 115, 116, 0]);