Skip to content

Commit

Permalink
tcp: deprecate TcpStream::try_clone() (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stjepan Glavina authored and tobz committed Jan 5, 2019
1 parent df299ce commit a687922
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tokio-tcp/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit a687922

Please sign in to comment.