std/os/windows/
mod.rs

1//! Platform-specific extensions to `std` for Windows.
2//!
3//! Provides access to platform-level information for Windows, and exposes
4//! Windows-specific idioms that would otherwise be inappropriate as part
5//! the core `std` library. These extensions allow developers to use
6//! `std` types and idioms with Windows in a way that the normal
7//! platform-agnostic idioms would not normally support.
8//!
9//! # Examples
10//!
11//! ```no_run
12//! use std::fs::File;
13//! use std::os::windows::prelude::*;
14//!
15//! fn main() -> std::io::Result<()> {
16//!     let f = File::create("foo.txt")?;
17//!     let handle = f.as_raw_handle();
18//!
19//!     // use handle with native windows bindings
20//!
21//!     Ok(())
22//! }
23//! ```
24
25#![stable(feature = "rust1", since = "1.0.0")]
26#![doc(cfg(windows))]
27#![deny(unsafe_op_in_unsafe_fn)]
28
29pub mod ffi;
30pub mod fs;
31pub mod io;
32pub mod process;
33pub mod raw;
34pub mod thread;
35
36/// A prelude for conveniently writing platform-specific code.
37///
38/// Includes all extension traits, and some important type definitions.
39#[stable(feature = "rust1", since = "1.0.0")]
40pub mod prelude {
41    #[doc(no_inline)]
42    #[stable(feature = "rust1", since = "1.0.0")]
43    pub use super::ffi::{OsStrExt, OsStringExt};
44    #[doc(no_inline)]
45    #[stable(feature = "file_offset", since = "1.15.0")]
46    pub use super::fs::FileExt;
47    #[doc(no_inline)]
48    #[stable(feature = "rust1", since = "1.0.0")]
49    pub use super::fs::{MetadataExt, OpenOptionsExt};
50    #[doc(no_inline)]
51    #[stable(feature = "rust1", since = "1.0.0")]
52    pub use super::io::{
53        AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, FromRawHandle, FromRawSocket,
54        HandleOrInvalid, IntoRawHandle, IntoRawSocket, OwnedHandle, OwnedSocket,
55    };
56    #[doc(no_inline)]
57    #[stable(feature = "rust1", since = "1.0.0")]
58    pub use super::io::{AsRawHandle, AsRawSocket, RawHandle, RawSocket};
59}