macro_rules! c_str {
($s:expr) => { ... };
}
Expand description
This is a helper macro to create a &'static CStr
.
It can be used on all Rust versions supported by PyO3, unlike cāā literals which were stabilised in Rust 1.77.
Due to the nature of PyO3 making heavy use of C FFI interop with Python, it is common for PyO3 to use CStr.
Examples:
use std::ffi::CStr;
const HELLO: &CStr = pyo3_ffi::c_str!("hello");
static WORLD: &CStr = pyo3_ffi::c_str!("world");