tcp: implement "split_mut" for TcpStream (#1289)

This commit is contained in:
Diggory Blake
2019-07-16 10:28:00 -07:00
committed by Carl Lerche
parent 448d9d2eab
commit 0d99ddd4f4
2 changed files with 96 additions and 1 deletions
+13 -1
View File
@@ -1,4 +1,7 @@
use crate::split::{split, TcpStreamReadHalf, TcpStreamWriteHalf};
use crate::split::{
split, split_mut, TcpStreamReadHalf, TcpStreamReadHalfMut, TcpStreamWriteHalf,
TcpStreamWriteHalfMut,
};
use bytes::{Buf, BufMut};
use futures_core::ready;
use iovec::IoVec;
@@ -724,6 +727,15 @@ impl TcpStream {
split(self)
}
/// Split a `TcpStream` into a read half and a write half, which can be used
/// to read and write the stream concurrently.
///
/// See the module level documenation of [`split`](super::split) for more
/// details.
pub fn split_mut<'a>(&'a mut self) -> (TcpStreamReadHalfMut<'a>, TcpStreamWriteHalfMut<'a>) {
split_mut(self)
}
// == Poll IO functions that takes `&self` ==
//
// They are not public because (taken from the doc of `PollEvented`):