      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105

    //! Platform-specific types, as defined by C.
    //!
    //! Code that interacts via FFI will almost certainly be using the
    //! base types provided by C, which aren't nearly as nicely defined
    //! as Rust's primitive types. This module provides types which will
    //! match those defined by C, so that code that interacts with C will
    //! refer to the correct types.

    #![stable(feature = "raw_os", since = "1.1.0")]

    #[doc(include = "os/raw/char.md")]
    #[cfg(any(all(target_os = "linux", any(target_arch = "aarch64",
                                           target_arch = "arm",
                                           target_arch = "powerpc",
                                           target_arch = "powerpc64",
                                           target_arch = "s390x")),
              all(target_os = "android", any(target_arch = "aarch64",
                                             target_arch = "arm")),
              all(target_os = "l4re", target_arch = "x86_64"),
              all(target_os = "freebsd", any(target_arch = "aarch64",
                                             target_arch = "arm",
                                             target_arch = "powerpc",
                                             target_arch = "powerpc64")),
              all(target_os = "netbsd", any(target_arch = "aarch64",
                                            target_arch = "arm",
                                            target_arch = "powerpc")),
              all(target_os = "openbsd", target_arch = "aarch64"),
              all(target_os = "fuchsia", target_arch = "aarch64")))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
    #[doc(include = "os/raw/char.md")]
    #[cfg(not(any(all(target_os = "linux", any(target_arch = "aarch64",
                                               target_arch = "arm",
                                               target_arch = "powerpc",
                                               target_arch = "powerpc64",
                                               target_arch = "s390x")),
                  all(target_os = "android", any(target_arch = "aarch64",
                                                 target_arch = "arm")),
                  all(target_os = "l4re", target_arch = "x86_64"),
                  all(target_os = "freebsd", any(target_arch = "aarch64",
                                                 target_arch = "arm",
                                                 target_arch = "powerpc",
                                                 target_arch = "powerpc64")),
                  all(target_os = "netbsd", any(target_arch = "aarch64",
                                                target_arch = "arm",
                                                target_arch = "powerpc")),
                  all(target_os = "openbsd", target_arch = "aarch64"),
                  all(target_os = "fuchsia", target_arch = "aarch64"))))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
    #[doc(include = "os/raw/schar.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
    #[doc(include = "os/raw/uchar.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8;
    #[doc(include = "os/raw/short.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_short = i16;
    #[doc(include = "os/raw/ushort.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ushort = u16;
    #[doc(include = "os/raw/int.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_int = i32;
    #[doc(include = "os/raw/uint.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_uint = u32;
    #[doc(include = "os/raw/long.md")]
    #[cfg(any(target_pointer_width = "32", windows))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i32;
    #[doc(include = "os/raw/ulong.md")]
    #[cfg(any(target_pointer_width = "32", windows))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u32;
    #[doc(include = "os/raw/long.md")]
    #[cfg(all(target_pointer_width = "64", not(windows)))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_long = i64;
    #[doc(include = "os/raw/ulong.md")]
    #[cfg(all(target_pointer_width = "64", not(windows)))]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulong = u64;
    #[doc(include = "os/raw/longlong.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_longlong = i64;
    #[doc(include = "os/raw/ulonglong.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_ulonglong = u64;
    #[doc(include = "os/raw/float.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_float = f32;
    #[doc(include = "os/raw/double.md")]
    #[stable(feature = "raw_os", since = "1.1.0")] pub type c_double = f64;

    #[stable(feature = "raw_os", since = "1.1.0")]
    #[doc(no_inline)]
    pub use core::ffi::c_void;

    #[cfg(test)]
    #[allow(unused_imports)]
    mod tests {
        use crate::any::TypeId;
        use crate::mem;

        macro_rules! ok {
            ($($t:ident)*) => {$(
                assert!(TypeId::of::<libc::$t>() == TypeId::of::<raw::$t>(),
                        "{} is wrong", stringify!($t));
            )*}
        }

        #[test]
        fn same() {
            use crate::os::raw;
            ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong
                c_longlong c_ulonglong c_float c_double);
        }
    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)