Macro tarantool::c_str

source ·
macro_rules! c_str {
    ($s:expr) => { ... };
}
Expand description

Returns a std::ffi::CStr constructed from the provided literal with a nul byte appended to the end. Use this when you need a &CStr from a string literal.

Example


let c_str = c_str!("hello");
assert_eq!(c_str.to_bytes(), b"hello");

This macro will also check at compile time if the string literal contains any interior nul bytes.

let this_doesnt_compile = c_str!("interior\0nul\0byte");