]> git.proxmox.com Git - rustc.git/blob - src/libstd/sys/mod.rs
New upstream version 1.21.0+dfsg1
[rustc.git] / src / libstd / sys / mod.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Platform-dependent platform abstraction
12 //!
13 //! The `std::sys` module is the abstracted interface through which
14 //! `std` talks to the underlying operating system. It has different
15 //! implementations for different operating system families, today
16 //! just Unix and Windows, and initial support for Redox.
17 //!
18 //! The centralization of platform-specific code in this module is
19 //! enforced by the "platform abstraction layer" tidy script in
20 //! `tools/tidy/src/pal.rs`.
21 //!
22 //! This module is closely related to the platform-independent system
23 //! integration code in `std::sys_common`. See that module's
24 //! documentation for details.
25 //!
26 //! In the future it would be desirable for the independent
27 //! implementations of this module to be extracted to their own crates
28 //! that `std` can link to, thus enabling their implementation
29 //! out-of-tree via crate replacement. Though due to the complex
30 //! inter-dependencies within `std` that will be a challenging goal to
31 //! achieve.
32
33 #![allow(missing_debug_implementations)]
34
35 pub use self::imp::*;
36
37 #[cfg(unix)]
38 #[path = "unix/mod.rs"]
39 mod imp;
40
41 #[cfg(windows)]
42 #[path = "windows/mod.rs"]
43 mod imp;
44
45 #[cfg(target_os = "redox")]
46 #[path = "redox/mod.rs"]
47 mod imp;
48
49
50 // Import essential modules from both platforms when documenting.
51
52 #[cfg(all(dox, not(unix)))]
53 use os::linux as platform;
54
55 #[cfg(all(dox, not(any(unix, target_os = "redox"))))]
56 #[path = "unix/ext/mod.rs"]
57 pub mod unix_ext;
58
59 #[cfg(all(dox, any(unix, target_os = "redox")))]
60 pub use self::ext as unix_ext;
61
62
63 #[cfg(all(dox, not(windows)))]
64 #[macro_use]
65 #[path = "windows/compat.rs"]
66 mod compat;
67
68 #[cfg(all(dox, not(windows)))]
69 #[path = "windows/c.rs"]
70 mod c;
71
72 #[cfg(all(dox, not(windows)))]
73 #[path = "windows/ext/mod.rs"]
74 pub mod windows_ext;
75
76 #[cfg(all(dox, windows))]
77 pub use self::ext as windows_ext;