mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00
Add from_stream method
This commit is contained in:
parent
e8d4524586
commit
c1f1320203
@ -257,6 +257,13 @@ impl TcpStream {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new `TcpStream` from a `net::TcpStream`.
|
||||
pub fn from_stream(stream: net::TcpStream, handle: &Handle) -> io::Result<TcpStream> {
|
||||
Ok(TcpStream {
|
||||
io: try!(PollEvented::new(try!(mio::tcp::TcpStream::from_stream(stream)), handle)),
|
||||
})
|
||||
}
|
||||
|
||||
/// Creates a new `TcpStream` from the pending socket inside the given
|
||||
/// `std::net::TcpStream`, connecting it to the address specified.
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user