Closed VictorKoenders closed 3 years ago
Adds a cstr! macro that validates at compile time that the given string does not contain \0 bytes. The macro appends \0 and then calls unsafe { $crate::CStr::from_bytes_with_nul_unchecked(a.as_bytes()) } as suggested in #18
cstr!
\0
unsafe { $crate::CStr::from_bytes_with_nul_unchecked(a.as_bytes()) }
Closes #18
Updated documentation based on the given feedback
Thanks! Published 0.2.4.
Adds a
cstr!
macro that validates at compile time that the given string does not contain\0
bytes. The macro appends\0
and then callsunsafe { $crate::CStr::from_bytes_with_nul_unchecked(a.as_bytes()) }
as suggested in #18Closes #18