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
use futures::prelude::*;
use futures::task::{Context, Poll};
use std::fmt::Debug;
use std::io;
use std::net::SocketAddr;
use std::pin::Pin;
pub trait TcpStream: AsyncRead + AsyncWrite + Debug + Send {
fn poll_write_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
fn poll_read_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>>;
fn take_error(&self) -> io::Result<Option<io::Error>>;
fn local_addr(&self) -> io::Result<SocketAddr>;
fn peer_addr(&self) -> io::Result<SocketAddr>;
fn shutdown(&self, how: std::net::Shutdown) -> std::io::Result<()>;
#[cfg(unix)]
fn as_raw_fd(&self) -> std::os::unix::io::RawFd;
}
pub trait TcpListener: Debug + Send {
fn local_addr(&self) -> io::Result<SocketAddr>;
fn poll_accept(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<io::Result<Pin<Box<dyn TcpStream>>>>;
#[cfg(unix)]
fn as_raw_fd(&self) -> std::os::unix::io::RawFd;
}