compio_fs/stdio/mod.rs
1cfg_select! {
2 windows => {
3 mod windows;
4 pub use windows::*;
5 }
6 unix => {
7 mod unix;
8 pub use unix::*;
9 }
10 _ => {}
11}
12
13/// Constructs a handle to the standard input of the current process.
14///
15/// ## Platform specific
16/// * Windows: This handle is best used for non-interactive uses, such as when a
17/// file is piped into the application. For technical reasons, if `stdin` is a
18/// console handle, the read method is implemented by using an ordinary
19/// blocking read on a separate thread, and it is impossible to cancel that
20/// read. This can make shutdown of the runtime hang until the user presses
21/// enter.
22///
23/// [`AsyncRead`]: compio_io::AsyncRead
24pub fn stdin() -> Stdin {
25 Stdin::new()
26}
27
28/// Constructs a handle to the standard output of the current process.
29///
30/// Concurrent writes to stdout must be executed with care: Only individual
31/// writes to this [`AsyncWrite`] are guaranteed to be intact. In particular
32/// you should be aware that writes using [`write_all`] are not guaranteed
33/// to occur as a single write, so multiple threads writing data with
34/// [`write_all`] may result in interleaved output.
35///
36/// [`AsyncWrite`]: compio_io::AsyncWrite
37/// [`write_all`]: compio_io::AsyncWriteExt::write_all
38pub fn stdout() -> Stdout {
39 Stdout::new()
40}
41
42/// Constructs a handle to the standard error of the current process.
43///
44/// Concurrent writes to stderr must be executed with care: Only individual
45/// writes to this [`AsyncWrite`] are guaranteed to be intact. In particular
46/// you should be aware that writes using [`write_all`] are not guaranteed
47/// to occur as a single write, so multiple threads writing data with
48/// [`write_all`] may result in interleaved output.
49///
50/// [`AsyncWrite`]: compio_io::AsyncWrite
51/// [`write_all`]: compio_io::AsyncWriteExt::write_all
52pub fn stderr() -> Stderr {
53 Stderr::new()
54}