[−][src]Module tokio::net::tcp::split
TcpStream
split support.
A TcpStream
can be split into a TcpStreamReadHalf
and a
TcpStreamWriteHalf
with the TcpStream::split
method. TcpStreamReadHalf
implements AsyncRead
while TcpStreamWriteHalf
implements AsyncWrite
.
The two halves can be used concurrently, even from multiple tasks.
Compared to the generic split of AsyncRead + AsyncWrite
, this specialized
split gives read and write halves that are faster and smaller, because they
do not use locks. They also provide access to the underlying TcpStream
after split, implementing AsRef<TcpStream>
. This allows you to call
TcpStream
methods that takes &self
, e.g., to get local and peer
addresses, to get and set socket options, and to shutdown the sockets.
Structs
ReuniteError | Error indicating two halves were not from the same stream, and thus could
not be |
TcpStreamReadHalf | Read half of a |
TcpStreamReadHalfMut | Read half of a |
TcpStreamWriteHalf | Write half of a |
TcpStreamWriteHalfMut | Write half of a |