Debian Codegraph @

third_party/rust/rustix/src/ffi.rs

raw
1 //! Utilities related to FFI bindings.
2
3 // If we have std, use it.
4 #[cfg(windows)]
5 #[cfg(feature = "std")]
6 pub use std::os::raw::{c_char, c_int, c_long, c_short, c_uint, c_ulong, c_ushort};
7 #[cfg(not(windows))]
8 #[cfg(feature = "std")]
9 pub use {
10 std::ffi::{CStr, CString, FromBytesWithNulError, NulError},
11 std::os::raw::c_char,
12 };
13
14 // If we don't have std, we can depend on core and alloc having these features
15 // in Rust 1.64+.
16 #[cfg(not(windows))]
17 #[cfg(all(feature = "alloc", not(feature = "std")))]
18 pub use alloc::ffi::{CString, NulError};
19 #[cfg(windows)]
20 #[cfg(not(feature = "std"))]
21 pub use core::ffi::{c_char, c_int, c_long, c_short, c_uint, c_ulong, c_ushort, c_void};
22 #[cfg(not(windows))]
23 #[cfg(not(feature = "std"))]
24 pub use core::ffi::{c_char, CStr, FromBytesWithNulError};