mod.rs - source
Description: Source of the Rust file `library/std/src/os/mod.rs`.

#
std/os/
mod.rs

    1//! OS-specific functionality.
    2
    3#![stable(feature = "os", since = "1.0.0")]
    4#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
    5#![allow(unsafe_op_in_unsafe_fn)]
    6
    7pub mod raw;
    8
    9// The code below could be written clearer using `cfg_if!`. However, the items below are
    10// publicly exported by `std` and external tools can have trouble analysing them because of the use
    11// of a macro that is not vendored by Rust and included in the toolchain.
    12// See https://github.com/rust-analyzer/rust-analyzer/issues/6038.
    13
    14// On certain platforms right now the "main modules" modules that are
    15// documented don't compile (missing things in `libc` which is empty),
    16// so just omit them with an empty module and add the "unstable" attribute.
    17
    18// darwin, unix, linux, wasi and windows are handled a bit differently.
    19#[cfg(all(
    20    doc,
    21    any(
    22        all(target_arch = "wasm32", not(target_os = "wasi")),
    23        all(target_vendor = "fortanix", target_env = "sgx")
    24    )
    25))]
    26#[unstable(issue = "none", feature = "std_internals")]
    27pub mod darwin {}
    28#[cfg(all(
    29    doc,
    30    any(
    31        all(target_arch = "wasm32", not(target_os = "wasi")),
    32        all(target_vendor = "fortanix", target_env = "sgx")
    33    )
    34))]
    35#[unstable(issue = "none", feature = "std_internals")]
    36pub mod unix {}
    37#[cfg(all(
    38    doc,
    39    any(
    40        all(target_arch = "wasm32", not(target_os = "wasi")),
    41        all(target_vendor = "fortanix", target_env = "sgx")
    42    )
    43))]
    44#[unstable(issue = "none", feature = "std_internals")]
    45pub mod linux {}
    46#[cfg(all(
    47    doc,
    48    any(
    49        all(target_arch = "wasm32", not(target_os = "wasi")),
    50        all(target_vendor = "fortanix", target_env = "sgx")
    51    )
    52))]
    53#[unstable(issue = "none", feature = "std_internals")]
    54pub mod wasi {}
    55#[cfg(all(
    56    doc,
    57    any(
    58        all(target_arch = "wasm32", not(target_os = "wasi")),
    59        all(target_vendor = "fortanix", target_env = "sgx")
    60    )
    61))]
    62#[unstable(issue = "none", feature = "std_internals")]
    63pub mod windows {}
    64
    65// darwin
    66#[cfg(not(all(
    67    doc,
    68    any(
    69        all(target_arch = "wasm32", not(target_os = "wasi")),
    70        all(target_vendor = "fortanix", target_env = "sgx")
    71    )
    72)))]
    73#[cfg(any(target_vendor = "apple", doc))]
    74pub mod darwin;
    75
    76// unix
    77#[cfg(not(all(
    78    doc,
    79    any(
    80        all(target_arch = "wasm32", not(target_os = "wasi")),
    81        all(target_vendor = "fortanix", target_env = "sgx")
    82    )
    83)))]
    84#[cfg(all(not(target_os = "hermit"), any(unix, doc)))]
    85pub mod unix;
    86
    87// linux
    88#[cfg(not(all(
    89    doc,
    90    any(
    91        all(target_arch = "wasm32", not(target_os = "wasi")),
    92        all(target_vendor = "fortanix", target_env = "sgx")
    93    )
    94)))]
    95#[cfg(any(target_os = "linux", doc))]
    96pub mod linux;
    97
    98// wasi
    99#[cfg(not(all(
    100    doc,
    101    any(
    102        all(target_arch = "wasm32", not(target_os = "wasi")),
    103        all(target_vendor = "fortanix", target_env = "sgx")
    104    )
    105)))]
    106#[cfg(any(target_os = "wasi", any(target_env = "p1", target_env = "p2"), doc))]
    107pub mod wasi;
    108
    109#[cfg(any(all(target_os = "wasi", target_env = "p2"), doc))]
    110pub mod wasip2;
    111
    112// windows
    113#[cfg(not(all(
    114    doc,
    115    any(
    116        all(target_arch = "wasm32", not(target_os = "wasi")),
    117        all(target_vendor = "fortanix", target_env = "sgx")
    118    )
    119)))]
    120#[cfg(any(windows, doc))]
    121pub mod windows;
    122
    123// Others.
    124#[cfg(target_os = "aix")]
    125pub mod aix;
    126#[cfg(target_os = "android")]
    127pub mod android;
    128#[cfg(target_os = "cygwin")]
    129pub mod cygwin;
    130#[cfg(target_os = "dragonfly")]
    131pub mod dragonfly;
    132#[cfg(target_os = "emscripten")]
    133pub mod emscripten;
    134#[cfg(target_os = "espidf")]
    135pub mod espidf;
    136#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
    137pub mod fortanix_sgx;
    138#[cfg(target_os = "freebsd")]
    139pub mod freebsd;
    140#[cfg(target_os = "fuchsia")]
    141pub mod fuchsia;
    142#[cfg(target_os = "haiku")]
    143pub mod haiku;
    144#[cfg(target_os = "hermit")]
    145pub mod hermit;
    146#[cfg(target_os = "horizon")]
    147pub mod horizon;
    148#[cfg(target_os = "hurd")]
    149pub mod hurd;
    150#[cfg(target_os = "illumos")]
    151pub mod illumos;
    152#[cfg(target_os = "ios")]
    153pub mod ios;
    154#[cfg(target_os = "l4re")]
    155pub mod l4re;
    156#[cfg(target_os = "macos")]
    157pub mod macos;
    158#[cfg(target_os = "motor")]
    159pub mod motor;
    160#[cfg(target_os = "netbsd")]
    161pub mod netbsd;
    162#[cfg(target_os = "nto")]
    163pub mod nto;
    164#[cfg(target_os = "nuttx")]
    165pub mod nuttx;
    166#[cfg(target_os = "openbsd")]
    167pub mod openbsd;
    168#[cfg(target_os = "redox")]
    169pub mod redox;
    170#[cfg(target_os = "rtems")]
    171pub mod rtems;
    172#[cfg(target_os = "solaris")]
    173pub mod solaris;
    174#[cfg(target_os = "solid_asp3")]
    175pub mod solid;
    176#[cfg(target_os = "trusty")]
    177pub mod trusty;
    178#[cfg(target_os = "uefi")]
    179pub mod uefi;
    180#[cfg(target_os = "vita")]
    181pub mod vita;
    182#[cfg(target_os = "vxworks")]
    183pub mod vxworks;
    184#[cfg(target_os = "xous")]
    185pub mod xous;
    186
    187#[cfg(any(
    188    unix,
    189    target_os = "hermit",
    190    target_os = "trusty",
    191    target_os = "wasi",
    192    target_os = "motor",
    193    doc
    194))]
    195pub mod fd;
    196
    197#[cfg(any(target_os = "linux", target_os = "android", target_os = "cygwin", doc))]
    198mod net;