1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Async networking: TCP listener, TCP stream, UDP socket.
//!
//! # Traits
//! - [`AsyncRead`] — poll-based non-blocking read
//! - [`AsyncWrite`] — poll-based non-blocking write + flush + shutdown
//!
//! # Types
//! - [`TcpListener`] — accepts incoming TCP connections
//! - [`TcpStream`] — bidirectional async byte stream
//! - [`UdpSocket`] — connectionless async datagram socket
use io;
use Pin;
use ;
pub use TcpListener;
pub use TcpStream;
pub use UdpSocket;
// ── AsyncRead ─────────────────────────────────────────────────────────────────
/// Async version of `std::io::Read`.
///
/// The poll method must be called with a pinned `Self` and a `Context`.
/// It returns `Poll::Ready(Ok(n))` when `n` bytes have been written into
/// `buf`, or `Poll::Pending` when no bytes are available yet (the waker
/// will be called when data arrives).
// ── AsyncWrite ────────────────────────────────────────────────────────────────
/// Async version of `std::io::Write`.
///
/// All three poll methods follow the same contract: `Poll::Ready(Ok(...))`
/// on success, `Poll::Pending` when the underlying resource is not ready
/// (with the waker arranged to fire when it becomes ready).