]> git.proxmox.com Git - rustc.git/blob - src/libstd/sys/unix/ext/mod.rs
New upstream version 1.23.0+dfsg1
[rustc.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 //! 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.
21 //!
22 //! # Examples
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")]
37 #![doc(cfg(unix))]
38
39 pub mod io;
40 pub mod ffi;
41 pub mod fs;
42 pub mod process;
43 pub mod raw;
44 pub mod thread;
45 pub mod net;
46
47 /// A prelude for conveniently writing platform-specific code.
48 ///
49 /// Includes all extension traits, and some important type definitions.
50 #[stable(feature = "rust1", since = "1.0.0")]
51 pub mod prelude {
52 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
53 pub use super::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd};
54 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
55 pub use super::ffi::{OsStrExt, OsStringExt};
56 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
57 pub use super::fs::{PermissionsExt, OpenOptionsExt, MetadataExt, FileTypeExt};
58 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
59 pub use super::fs::DirEntryExt;
60 #[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")]
61 pub use super::fs::FileExt;
62 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
63 pub use super::thread::JoinHandleExt;
64 #[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
65 pub use super::process::{CommandExt, ExitStatusExt};
66 }