2016-03-04 17:37:11 -05:00
|
|
|
//! OS-specific functionality.
|
2012-03-02 17:20:00 -08:00
|
|
|
|
2015-03-30 11:00:05 -07:00
|
|
|
#![stable(feature = "os", since = "1.0.0")]
|
2018-08-29 08:21:01 -05:00
|
|
|
#![allow(missing_docs, nonstandard_style, missing_debug_implementations)]
|
2012-03-06 18:49:08 -08:00
|
|
|
|
2015-04-15 23:21:13 -07:00
|
|
|
pub mod raw;
|
2021-03-04 14:03:26 +01:00
|
|
|
|
2021-04-14 21:36:13 +02:00
|
|
|
// The code below could be written clearer using `cfg_if!`. However, the items below are
|
|
|
|
|
// publicly exported by `std` and external tools can have trouble analysing them because of the use
|
|
|
|
|
// of a macro that is not vendored by Rust and included in the toolchain.
|
|
|
|
|
// See https://github.com/rust-analyzer/rust-analyzer/issues/6038.
|
|
|
|
|
|
2021-09-03 17:21:52 +02:00
|
|
|
// On certain platforms right now the "main modules" modules that are
|
|
|
|
|
// documented don't compile (missing things in `libc` which is empty),
|
|
|
|
|
// so just omit them with an empty module and add the "unstable" attribute.
|
|
|
|
|
|
|
|
|
|
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))]
|
|
|
|
|
pub mod fortanix_sgx;
|
|
|
|
|
|
|
|
|
|
// Unix, linux, wasi and windows are handled a bit differently.
|
|
|
|
|
cfg_if::cfg_if! {
|
|
|
|
|
if #[cfg(all(
|
|
|
|
|
doc,
|
|
|
|
|
any(
|
|
|
|
|
all(target_arch = "wasm32", not(target_os = "wasi")),
|
|
|
|
|
all(target_vendor = "fortanix", target_env = "sgx")
|
|
|
|
|
)
|
|
|
|
|
))]
|
|
|
|
|
{
|
|
|
|
|
#[unstable(issue = "none", feature = "std_internals")]
|
|
|
|
|
pub mod unix {}
|
|
|
|
|
#[unstable(issue = "none", feature = "std_internals")]
|
|
|
|
|
pub mod linux {}
|
|
|
|
|
#[unstable(issue = "none", feature = "std_internals")]
|
|
|
|
|
pub mod wasi {}
|
|
|
|
|
#[unstable(issue = "none", feature = "std_internals")]
|
|
|
|
|
pub mod windows {}
|
|
|
|
|
} else {
|
|
|
|
|
#[cfg(target_os = "hermit")]
|
|
|
|
|
#[path = "hermit/mod.rs"]
|
|
|
|
|
pub mod unix;
|
|
|
|
|
|
|
|
|
|
#[cfg(any(unix, doc))]
|
|
|
|
|
pub mod unix;
|
|
|
|
|
|
|
|
|
|
#[cfg(any(target_os = "linux", target_os = "l4re", doc))]
|
|
|
|
|
pub mod linux;
|
|
|
|
|
|
|
|
|
|
#[cfg(any(target_os = "wasi", doc))]
|
|
|
|
|
pub mod wasi;
|
|
|
|
|
|
|
|
|
|
#[cfg(any(windows, doc))]
|
|
|
|
|
pub mod windows;
|
|
|
|
|
}
|
2021-04-14 21:36:13 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-03 17:21:52 +02:00
|
|
|
// Others.
|
|
|
|
|
#[cfg(target_os = "android")]
|
|
|
|
|
pub mod android;
|
|
|
|
|
#[cfg(target_os = "dragonfly")]
|
|
|
|
|
pub mod dragonfly;
|
|
|
|
|
#[cfg(target_os = "emscripten")]
|
|
|
|
|
pub mod emscripten;
|
|
|
|
|
#[cfg(target_os = "espidf")]
|
|
|
|
|
pub mod espidf;
|
|
|
|
|
#[cfg(target_os = "freebsd")]
|
|
|
|
|
pub mod freebsd;
|
|
|
|
|
#[cfg(target_os = "fuchsia")]
|
|
|
|
|
pub mod fuchsia;
|
|
|
|
|
#[cfg(target_os = "haiku")]
|
|
|
|
|
pub mod haiku;
|
|
|
|
|
#[cfg(target_os = "illumos")]
|
|
|
|
|
pub mod illumos;
|
|
|
|
|
#[cfg(target_os = "ios")]
|
|
|
|
|
pub mod ios;
|
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
pub mod macos;
|
|
|
|
|
#[cfg(target_os = "netbsd")]
|
|
|
|
|
pub mod netbsd;
|
|
|
|
|
#[cfg(target_os = "openbsd")]
|
|
|
|
|
pub mod openbsd;
|
|
|
|
|
#[cfg(target_os = "redox")]
|
|
|
|
|
pub mod redox;
|
|
|
|
|
#[cfg(target_os = "solaris")]
|
|
|
|
|
pub mod solaris;
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "vxworks")]
|
|
|
|
|
pub mod vxworks;
|
2021-07-28 07:28:58 -07:00
|
|
|
|
2021-08-19 12:24:25 -07:00
|
|
|
#[cfg(any(unix, target_os = "wasi", doc))]
|
2021-07-28 07:28:58 -07:00
|
|
|
mod fd;
|