cstr
A macro for getting &'static CStr
from literal or identifier.
This macro checks whether the given literal is valid for CStr
at compile time, and returns a static reference of CStr
.
Note that it currently cannot be used to initialize constants due to restriction of Rust.
Example
use cstr;
use CStr;
let test = cstr!;
assert_eq!;
let test = cstr!;
assert_eq!;
let test = cstr!;
assert_eq!;