]>
Commit | Line | Data |
---|---|---|
d9579d0f AL |
1 | // Copyright 2014 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 | //! Experimental extensions to `std` for Unix platforms. | |
12 | //! | |
abe05a73 XL |
13 | //! Provides access to platform-level information on Unix platforms, and |
14 | //! exposes Unix-specific functions that would otherwise be inappropriate as | |
15 | //! part of the core `std` library. | |
16 | //! | |
17 | //! It exposes more ways to deal with platform-specific strings (`OsStr`, | |
18 | //! `OsString`), allows to set permissions more granularly, extract low-level | |
19 | //! file descriptors from files and sockets, and has platform-specific helpers | |
20 | //! for spawning processes. | |
d9579d0f | 21 | //! |
3b2f2976 | 22 | //! # Examples |
d9579d0f AL |
23 | //! |
24 | //! ```no_run | |
25 | //! use std::fs::File; | |
26 | //! use std::os::unix::prelude::*; | |
27 | //! | |
28 | //! fn main() { | |
29 | //! let f = File::create("foo.txt").unwrap(); | |
30 | //! let fd = f.as_raw_fd(); | |
31 | //! | |
32 | //! // use fd with native unix bindings | |
33 | //! } | |
34 | //! ``` | |
35 | ||
36 | #![stable(feature = "rust1", since = "1.0.0")] | |
3b2f2976 | 37 | #![doc(cfg(unix))] |
94b46f34 | 38 | #![allow(missing_docs)] |
d9579d0f AL |
39 | |
40 | pub mod io; | |
41 | pub mod ffi; | |
42 | pub mod fs; | |
43 | pub mod process; | |
44 | pub mod raw; | |
92a42be0 | 45 | pub mod thread; |
54a0048b | 46 | pub mod net; |
d9579d0f AL |
47 | |
48 | /// A prelude for conveniently writing platform-specific code. | |
49 | /// | |
50 | /// Includes all extension traits, and some important type definitions. | |
51 | #[stable(feature = "rust1", since = "1.0.0")] | |
52 | pub mod prelude { | |
92a42be0 | 53 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
e9174d1e | 54 | pub use super::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; |
d9579d0f AL |
55 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
56 | pub use super::ffi::{OsStrExt, OsStringExt}; | |
92a42be0 | 57 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
c1a9b12d | 58 | pub use super::fs::{PermissionsExt, OpenOptionsExt, MetadataExt, FileTypeExt}; |
92a42be0 | 59 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
54a0048b | 60 | pub use super::fs::DirEntryExt; |
476ff2be | 61 | #[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")] |
c30ab7b3 | 62 | pub use super::fs::FileExt; |
54a0048b SL |
63 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
64 | pub use super::thread::JoinHandleExt; | |
d9579d0f AL |
65 | #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")] |
66 | pub use super::process::{CommandExt, ExitStatusExt}; | |
67 | } |