Macro uefi_macros::cstr16

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

Builds a CStr16 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!(cstr16!().to_u16_slice_with_nul(), [0]);
assert_eq!(cstr16!("").to_u16_slice_with_nul(), [0]);
// Non-empty string
assert_eq!(cstr16!("test €").to_u16_slice_with_nul(), [116, 101, 115, 116, 32, 8364, 0]);