Skip to main content

std/os/raw/
mod.rs

1//! Compatibility module for C platform-specific types. Use [`core::ffi`] instead.
2
3#![stable(feature = "raw_os", since = "1.1.0")]
4
5#[cfg(test)]
6mod tests;
7
8macro_rules! alias_core_ffi {
9    ($($t:ident)*) => {$(
10        #[stable(feature = "raw_os", since = "1.1.0")]
11        #[doc = include_str!(concat!("../../../../core/src/ffi/", stringify!($t), ".md"))]
12//         #[doc(cfg(all()))] // commented out for std.noratrieb.dev
13        pub type $t = core::ffi::$t;
14    )*}
15}
16
17#[stable(feature = "raw_os", since = "1.1.0")]
#[doc =
"Equivalent to C\'s `void` type when used as a [pointer].\n\nIn essence, `*const c_void` is equivalent to C\'s `const void*`\nand `*mut c_void` is equivalent to C\'s `void*`. That said, this is\n*not* the same as C\'s `void` return type, which is Rust\'s `()` type.\n\nTo model pointers to opaque types in FFI, until `extern type` is\nstabilized, it is recommended to use a newtype wrapper around an empty\nbyte array. See the [Nomicon] for details.\n\nOne could use `std::os::raw::c_void` if they want to support old Rust\ncompiler down to 1.1.0. After Rust 1.30.0, it was re-exported by\nthis definition. For more information, please read [RFC 2521].\n\n[Nomicon]: https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs\n[RFC 2521]: https://github.com/rust-lang/rfcs/blob/master/text/2521-c_void-reunification.md\n"]
pub type c_void = core::ffi::c_void;alias_core_ffi! {
18    c_char c_schar c_uchar
19    c_short c_ushort
20    c_int c_uint
21    c_long c_ulong
22    c_longlong c_ulonglong
23    c_float
24    c_double
25    c_void
26}