tokio::net::TcpStream 是如何实现 tokio::prelude::Stream 的?

How does tokio::net::TcpStream implement tokio::prelude::Stream?

tokio.rs 文档中,我们看到以下片段

// split the socket stream into readable and writable parts
let (reader, writer) = socket.split();
// copy bytes from the reader into the writer
let amount = io::copy(reader, writer);

我假设 split 确实是 Stream::split, but I can't figure out how this trait applies to TcpStream,因为流页面没有提到 TcpStream,反之亦然。

tokio::net::TcpStream implements AsyncRead

AsyncRead 提供的方法之一是 split():

fn split(self) -> (ReadHalf<Self>, WriteHalf<Self>)
where
    Self: AsyncWrite, 

所以在这种情况下,它不是 Stream::split 正如你的问题所暗示的那样,因为根据你的观察 tokio::net::TcpStream 不是 Stream.

的实现者