]> git.lizzy.rs Git - rust.git/blob - src/libstd/sys/unix/ext/mod.rs
98bc90dd4e13246694c14531affe2fd53cd47012
[rust.git] / src / libstd / sys / unix / ext / mod.rs
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 //!
13 //! For now, this module is limited to extracting file descriptors,
14 //! but its functionality will grow over time.
15 //!
16 //! # Examples
17 //!
18 //! ```no_run
19 //! use std::fs::File;
20 //! use std::os::unix::prelude::*;
21 //!
22 //! fn main() {
23 //!     let f = File::create("foo.txt").unwrap();
24 //!     let fd = f.as_raw_fd();
25 //!
26 //!     // use fd with native unix bindings
27 //! }
28 //! ```
29
30 #![stable(feature = "rust1", since = "1.0.0")]
31 #![doc(cfg(unix))]
32
33 pub mod io;
34 pub mod ffi;
35 pub mod fs;
36 pub mod process;
37 pub mod raw;
38 pub mod thread;
39 pub mod net;
40
41 /// A prelude for conveniently writing platform-specific code.
42 ///
43 /// Includes all extension traits, and some important type definitions.
44 #[stable(feature = "rust1", since = "1.0.0")]
45 pub mod prelude {
46     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
47     pub use super::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd};
48     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
49     pub use super::ffi::{OsStrExt, OsStringExt};
50     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
51     pub use super::fs::{PermissionsExt, OpenOptionsExt, MetadataExt, FileTypeExt};
52     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
53     pub use super::fs::DirEntryExt;
54     #[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")]
55     pub use super::fs::FileExt;
56     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
57     pub use super::thread::JoinHandleExt;
58     #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
59     pub use super::process::{CommandExt, ExitStatusExt};
60 }