Touch up TcpStream::from_stream

This commit is contained in:
Alex Crichton
2017-01-24 16:39:01 -08:00
parent 4363663dea
commit a4b4d57cb7
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ appveyor = { repository = "alexcrichton/tokio-core" }
[dependencies]
futures = "0.1.9"
log = "0.3"
mio = "0.6"
mio = "0.6.4"
scoped-tls = "0.1.0"
slab = "0.3"
+8 -2
View File
@@ -267,9 +267,15 @@ impl TcpStream {
}
/// Create a new `TcpStream` from a `net::TcpStream`.
pub fn from_stream(stream: net::TcpStream, handle: &Handle) -> io::Result<TcpStream> {
///
/// This function will convert a TCP stream in the standard library to a TCP
/// stream ready to be used with the provided event loop handle. The object
/// returned is associated with the event loop and ready to perform I/O.
pub fn from_stream(stream: net::TcpStream, handle: &Handle)
-> io::Result<TcpStream> {
let inner = try!(mio::tcp::TcpStream::from_stream(stream));
Ok(TcpStream {
io: try!(PollEvented::new(try!(mio::tcp::TcpStream::from_stream(stream)), handle)),
io: try!(PollEvented::new(inner, handle)),
})
}