#compile-time #create #safely #c-str #const

const-c-str

Safely create &CStr at compile time

2 releases

0.1.1 Mar 6, 2019
0.1.0 Mar 5, 2019

#14 in #c-str

MIT/Apache

3KB

Crates.io api

const-c-str

Safely create &CStr at compile time checked with from_bytes_with_nul

Examples

use const_c_str::c_str;

#[cfg(feature = "const_cstr_unchecked")]
const greeting: &std::ffi::CStr = c_str!("Hello World!");

lib.rs:

Safely create &CStr at compile time checked with from_bytes_with_nul

Examples

use const_c_str::c_str;

#[cfg(feature = "const_cstr_unchecked")]
const greeting: &std::ffi::CStr = c_str!("Hello World!");

Dependencies

~2MB
~45K SLoC