tokio/io/util/
mod.rs

1#![allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
2
3cfg_io_util! {
4    mod async_buf_read_ext;
5    pub use async_buf_read_ext::AsyncBufReadExt;
6
7    mod async_read_ext;
8    pub use async_read_ext::AsyncReadExt;
9
10    mod async_seek_ext;
11    pub use async_seek_ext::AsyncSeekExt;
12
13    mod async_write_ext;
14    pub use async_write_ext::AsyncWriteExt;
15
16    mod buf_reader;
17    pub use buf_reader::BufReader;
18
19    mod buf_stream;
20    pub use buf_stream::BufStream;
21
22    mod buf_writer;
23    pub use buf_writer::BufWriter;
24
25    mod chain;
26
27    mod copy;
28    pub use copy::copy;
29
30    mod copy_bidirectional;
31    pub use copy_bidirectional::{copy_bidirectional, copy_bidirectional_with_sizes};
32
33    mod copy_buf;
34    pub use copy_buf::copy_buf;
35
36    mod empty;
37    pub use empty::{empty, Empty};
38
39    mod flush;
40
41    mod lines;
42    pub use lines::Lines;
43
44    mod mem;
45    pub use mem::{duplex, simplex, DuplexStream, SimplexStream};
46
47    mod read;
48    mod read_buf;
49    mod read_exact;
50    mod read_int;
51    mod read_line;
52    mod fill_buf;
53
54    mod read_to_end;
55    mod vec_with_initialized;
56    cfg_process! {
57        pub(crate) use read_to_end::read_to_end;
58    }
59
60    mod read_to_string;
61    mod read_until;
62
63    mod repeat;
64    pub use repeat::{repeat, Repeat};
65
66    mod shutdown;
67
68    mod sink;
69    pub use sink::{sink, Sink};
70
71    mod split;
72    pub use split::Split;
73
74    mod take;
75    pub use take::Take;
76
77    mod write;
78    mod write_vectored;
79    mod write_all;
80    mod write_buf;
81    mod write_all_buf;
82    mod write_int;
83
84
85    // used by `BufReader` and `BufWriter`
86    // https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/io.rs#L1
87    const DEFAULT_BUF_SIZE: usize = 8 * 1024;
88
89    cfg_coop! {
90        fn poll_proceed_and_make_progress(cx: &mut std::task::Context<'_>) -> std::task::Poll<()> {
91            let coop = std::task::ready!(crate::runtime::coop::poll_proceed(cx));
92            coop.made_progress();
93            std::task::Poll::Ready(())
94        }
95    }
96
97    cfg_not_coop! {
98        fn poll_proceed_and_make_progress(_: &mut std::task::Context<'_>) -> std::task::Poll<()> {
99            std::task::Poll::Ready(())
100        }
101    }
102}
103
104cfg_not_io_util! {
105    cfg_process! {
106        mod vec_with_initialized;
107        mod read_to_end;
108        // Used by process
109        pub(crate) use read_to_end::read_to_end;
110    }
111}