1#![doc(html_root_url = "https://docs.rs/cstrptr/0.1.3/")]
3#![cfg_attr(feature = "unstable", feature(const_raw_ptr_deref))]
4#![cfg_attr(not(feature = "std"), no_std)]
5
6#[cfg(all(not(feature = "std"), feature = "alloc"))]
7extern crate alloc;
8
9#[cfg(not(feature = "std"))]
10mod cstr;
11#[cfg(all(not(feature = "std"), feature = "alloc"))]
12mod cstring;
13mod ptr;
14
15#[cfg(not(feature = "std"))]
16pub use cstr::{CStr, FromBytesWithNulError};
17#[cfg(all(not(feature = "std"), feature = "alloc"))]
18pub use cstring::CString;
19pub use ptr::CStrPtr;
20#[cfg(feature = "std")]
21pub use std::ffi::{CStr, CString, FromBytesWithNulError};
22
23#[macro_export]
24macro_rules! cstr {
25 ($s:expr) => {
26 unsafe { $crate::CStr::from_bytes_with_nul_unchecked(concat!($s, "\0").as_bytes()) }
27 };
28}