2015-04-16 06:21:13 +00:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
//! Experimental extensions to `std` for Unix platforms.
|
|
|
|
//!
|
2017-10-31 09:41:10 +00:00
|
|
|
//! Provides access to platform-level information on Unix platforms, and
|
|
|
|
//! exposes Unix-specific functions that would otherwise be inappropriate as
|
|
|
|
//! part of the core `std` library.
|
|
|
|
//!
|
|
|
|
//! It exposes more ways to deal with platform-specific strings (`OsStr`,
|
|
|
|
//! `OsString`), allows to set permissions more granularly, extract low-level
|
|
|
|
//! file descriptors from files and sockets, and has platform-specific helpers
|
|
|
|
//! for spawning processes.
|
2015-04-16 06:21:13 +00:00
|
|
|
//!
|
2017-08-24 15:33:36 +00:00
|
|
|
//! # Examples
|
2015-04-16 06:21:13 +00:00
|
|
|
//!
|
|
|
|
//! ```no_run
|
|
|
|
//! use std::fs::File;
|
|
|
|
//! use std::os::unix::prelude::*;
|
|
|
|
//!
|
|
|
|
//! fn main() {
|
|
|
|
//! let f = File::create("foo.txt").unwrap();
|
|
|
|
//! let fd = f.as_raw_fd();
|
|
|
|
//!
|
|
|
|
//! // use fd with native unix bindings
|
|
|
|
//! }
|
|
|
|
//! ```
|
|
|
|
|
|
|
|
#![stable(feature = "rust1", since = "1.0.0")]
|
2017-08-05 06:39:46 +00:00
|
|
|
#![doc(cfg(unix))]
|
2015-04-16 06:21:13 +00:00
|
|
|
|
|
|
|
pub mod io;
|
|
|
|
pub mod ffi;
|
|
|
|
pub mod fs;
|
|
|
|
pub mod process;
|
|
|
|
pub mod raw;
|
2015-12-04 02:58:00 +00:00
|
|
|
pub mod thread;
|
2016-03-17 03:50:45 +00:00
|
|
|
pub mod net;
|
2015-04-16 06:21:13 +00:00
|
|
|
|
|
|
|
/// A prelude for conveniently writing platform-specific code.
|
|
|
|
///
|
|
|
|
/// Includes all extension traits, and some important type definitions.
|
|
|
|
#[stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
pub mod prelude {
|
2015-11-16 16:54:28 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
2015-08-19 00:23:45 +00:00
|
|
|
pub use super::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd};
|
2015-04-16 06:21:13 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
pub use super::ffi::{OsStrExt, OsStringExt};
|
2015-11-16 16:54:28 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
2015-07-05 21:16:25 +00:00
|
|
|
pub use super::fs::{PermissionsExt, OpenOptionsExt, MetadataExt, FileTypeExt};
|
2015-11-16 16:54:28 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
2016-04-07 17:42:53 +00:00
|
|
|
pub use super::fs::DirEntryExt;
|
2016-12-14 19:35:05 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "file_offset", since = "1.15.0")]
|
2016-08-15 23:11:33 +00:00
|
|
|
pub use super::fs::FileExt;
|
2016-04-07 17:42:53 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
pub use super::thread::JoinHandleExt;
|
2015-04-16 06:21:13 +00:00
|
|
|
#[doc(no_inline)] #[stable(feature = "rust1", since = "1.0.0")]
|
|
|
|
pub use super::process::{CommandExt, ExitStatusExt};
|
|
|
|
}
|