tcp: deprecate TcpStream::try_clone() (#824)

This commit is contained in:
Stjepan Glavina
2019-01-05 10:55:58 -05:00
committed by Toby Lawrence
parent df299ced45
commit a687922746
+7 -2
View File
@@ -781,9 +781,14 @@ impl TcpStream {
/// # Ok(())
/// # }
/// ```
#[deprecated(since = "0.1.14", note = "use `split()` instead")]
#[doc(hidden)]
pub fn try_clone(&self) -> io::Result<TcpStream> {
let io = self.io.get_ref().try_clone()?;
Ok(TcpStream::new(io))
// Rationale for deprecation:
// - https://github.com/tokio-rs/tokio/pull/824
// - https://github.com/tokio-rs/tokio/issues/774#issuecomment-451059317
let msg = "`TcpStream::split()` is deprecated because it doesn't work as intended";
Err(io::Error::new(io::ErrorKind::Other, msg))
}
}