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 #![doc(cfg(windows))] 26 27 pub mod ffi; 28 pub mod fs; 29 pub mod io; 30 pub mod process; 31 pub mod raw; 32 pub mod thread; 33 34 /// A prelude for conveniently writing platform-specific code. 35 /// 36 /// Includes all extension traits, and some important type definitions. 37 pub mod prelude { 38 #[doc(no_inline)] 39 pub use super::ffi::{OsStrExt, OsStringExt}; 40 #[doc(no_inline)] 41 pub use super::fs::FileExt; 42 #[doc(no_inline)] 43 pub use super::fs::{MetadataExt, OpenOptionsExt}; 44 #[doc(no_inline)] 45 pub use super::io::{ 46 AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, FromRawHandle, FromRawSocket, 47 HandleOrInvalid, IntoRawHandle, IntoRawSocket, OwnedHandle, OwnedSocket, 48 }; 49 #[doc(no_inline)] 50 pub use super::io::{AsRawHandle, AsRawSocket, RawHandle, RawSocket}; 51 } 52