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    pub use chain::Chain;
27
28    mod copy;
29    pub use copy::copy;
30
31    mod copy_bidirectional;
32    pub use copy_bidirectional::{copy_bidirectional, copy_bidirectional_with_sizes};
33
34    mod copy_buf;
35    pub use copy_buf::copy_buf;
36
37    mod empty;
38    pub use empty::{empty, Empty};
39
40    mod flush;
41
42    mod lines;
43    pub use lines::Lines;
44
45    mod mem;
46    pub use mem::{duplex, simplex, DuplexStream, SimplexStream};
47
48    mod read;
49    mod read_buf;
50    mod read_exact;
51    mod read_int;
52    mod read_line;
53    mod fill_buf;
54
55    mod read_to_end;
56    mod vec_with_initialized;
57    cfg_process! {
58        pub(crate) use read_to_end::read_to_end;
59    }
60
61    mod read_to_string;
62    mod read_until;
63
64    mod repeat;
65    pub use repeat::{repeat, Repeat};
66
67    mod shutdown;
68
69    mod sink;
70    pub use sink::{sink, Sink};
71
72    mod split;
73    pub use split::Split;
74
75    mod take;
76    pub use take::Take;
77
78    mod write;
79    mod write_vectored;
80    mod write_all;
81    mod write_buf;
82    mod write_all_buf;
83    mod write_int;
84
85
86    // used by `BufReader` and `BufWriter`
87    // https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/io.rs#L1
88    const DEFAULT_BUF_SIZE: usize = 8 * 1024;
89
90    cfg_coop! {
91        fn poll_proceed_and_make_progress(cx: &mut std::task::Context<'_>) -> std::task::Poll<()> {
92            let coop = std::task::ready!(crate::task::coop::poll_proceed(cx));
93            coop.made_progress();
94            std::task::Poll::Ready(())
95        }
96    }
97
98    cfg_not_coop! {
99        fn poll_proceed_and_make_progress(_: &mut std::task::Context<'_>) -> std::task::Poll<()> {
100            std::task::Poll::Ready(())
101        }
102    }
103}
104
105cfg_not_io_util! {
106    cfg_process! {
107        mod vec_with_initialized;
108        mod read_to_end;
109        // Used by process
110        pub(crate) use read_to_end::read_to_end;
111    }
112}