Macro c8

Source
macro_rules! c8 {
    ($string:literal) => { ... };
}
Expand description

Makes a new C8Str constant from a string literal. This macro adds the null terminator for you and checks validity at compile time.

const MY_C8: &C8Str = c8!("hello");
assert_eq!(MY_C8, C8Str::from_str_with_nul("hello\0").unwrap());

The macro will fail to compile if the argument contains null bytes:

c8!("doesn't compile\0");