nuclei/io/mod.rs
1//! IO: [`Handle`] (async operations on std's sockets and files), the
2//! `futures-io` traits, and the utilities every stream gets: the reads and
3//! writes of [`AsyncReadExt`], [`AsyncWriteExt`], [`AsyncBufReadExt`] and
4//! [`AsyncSeekExt`] as futures, [`ReadBuf`], [`copy`] and
5//! [`copy_bidirectional`], [`BufReader`], [`BufWriter`] and [`BufStream`],
6//! the in-memory pipes [`duplex`] and [`simplex`], [`split`], [`empty`],
7//! [`repeat`] and [`sink`], the process's [`stdin`], [`stdout`] and
8//! [`stderr`], what the sockets' readiness calls take and answer
9//! ([`Interest`], [`Ready`]), the caller's own buffers the owned calls take
10//! and give back ([`IoBuf`], [`IoBufMut`], [`IoVecBuf`], [`IoVecBufMut`],
11//! [`AlignedBuf`]), and on unix [`AsyncFd`](unix::AsyncFd), a caller's own
12//! descriptor driven by readiness.
13//!
14//! Inside, the shards' half of IO: sources, the drivers' half of every
15//! handle, and the system calls they make. A handle's IO object stays its own
16//! (std's sockets and files); its source is what the shard's driver reaches.
17//! The driver completes every operation, into and out of the pool's buffers,
18//! at once when it can and on readiness otherwise, and wakes the task, which
19//! takes the result.
20
21#[cfg(unix)]
22mod async_fd;
23#[cfg(unix)]
24pub(crate) mod caller;
25pub(crate) mod handle;
26pub(crate) mod raw;
27mod ready;
28pub(crate) mod side;
29pub(crate) mod source;
30pub(crate) mod sys;
31mod util;
32
33pub use futures_io::{AsyncBufRead, AsyncRead, AsyncSeek, AsyncWrite};
34
35pub use self::handle::{Handle, IoObject};
36pub use self::ready::{Interest, Ready};
37pub use crate::buf::aligned::AlignedBuf;
38pub use crate::buf::owned::{IoBuf, IoBufMut};
39pub use crate::buf::vectored::{IoVecBuf, IoVecBufMut};
40
41/// Unix's own: [`AsyncFd`](unix::AsyncFd), a caller's descriptor driven by
42/// readiness, and its guards.
43#[cfg(unix)]
44pub mod unix {
45 pub use super::async_fd::{AsyncFd, AsyncFdReadyGuard, AsyncFdReadyMutGuard, TryIoError};
46}
47pub(crate) use self::source::Source;
48pub use self::util::{
49 AsyncBufReadExt, AsyncReadExt, AsyncSeekExt, AsyncWriteExt, BufReader, BufStream, BufWriter,
50 Chain, DuplexStream, Empty, FillBuf, Flush, Lines, Read, ReadBuf, ReadBufFuture, ReadExact,
51 ReadHalf, ReadLine, ReadNumber, ReadToEnd, ReadToString, ReadUntil, Repeat, Seek, Shutdown,
52 SimplexReader, SimplexWriter, Sink, Split, Stderr, Stdin, Stdout, Take, Write, WriteAll,
53 WriteHalf, WriteNumber, WriteVectored, copy, copy_bidirectional, copy_bidirectional_with_sizes,
54 copy_buf, duplex, empty, repeat, simplex, sink, split, stderr, stdin, stdout,
55};