1 | //! Utilities related to FFI bindings. |
---|---|
2 | |
3 | // If we have std, use it. |
4 | #[cfg(feature = "std")] |
5 | pub use { |
6 | std::ffi::{CStr, CString, FromBytesWithNulError, NulError}, |
7 | std::os::raw::c_char, |
8 | }; |
9 | |
10 | // If we don't have std, we can depend on core and alloc having these features |
11 | // in Rust 1.64+. |
12 | #[cfg(all(feature = "alloc", not(feature = "std")))] |
13 | pub use alloc::ffi::{CString, NulError}; |
14 | #[cfg(not(feature = "std"))] |
15 | pub use core::ffi::{c_char, CStr, FromBytesWithNulError}; |
16 |