Macro byte_strings::const_cstr[][src]

macro_rules! const_cstr {
    () => { ... };
    ($($s : expr), * $(,) ?) => { ... };
}
Expand description

const-friendly version of c_str!.

use ::byte_strings::const_;

const MESSAGE: &str = "Hello, World!";
const C_MESSAGE: &const_::CStr = const_::c_str!(MESSAGE);

Inner null bytes are still rejected at compile time:

use ::byte_strings::const_;

const MESSAGE: &str = "Hell\0, World!";
const C_MESSAGE: &const_::CStr = const_::c_str!(MESSAGE); // Error.