Macro abi_stable::nulstr
source · macro_rules! nulstr { ($str:expr $(,)*) => { ... }; }
Expand description
Constructs a NulStr
from a string literal.
§Error
This causes a compile-time error if the input string contains nul byte(s).
§Example
use abi_stable::nulstr;
assert_eq!( nulstr!("Huh?").to_str_with_nul(), "Huh?\0" );
assert_eq!( nulstr!("Hello!").to_str_with_nul(), "Hello!\0" );
Nul bytes in the middle of the string cause compilation errors:
ⓘ
use abi_stable::nulstr;
assert_eq!(nulstr!("Hello\0, world!").to_str_with_nul(), "Hello\0");