@@ -103,10 +103,10 @@ impl TcpListener {
103
103
/// will only be for the same IP version as `addr` specified. That is, if
104
104
/// `addr` is an IPv4 address then all sockets accepted will be IPv4 as
105
105
/// well (same for IPv6).
106
- pub fn from_listener ( listener : net:: TcpListener ,
107
- addr : & SocketAddr ,
108
- handle : & Handle ) -> io:: Result < TcpListener > {
109
- let l = try! ( mio:: net:: TcpListener :: from_listener ( listener, addr) ) ;
106
+ pub fn from_std ( listener : net:: TcpListener ,
107
+ addr : & SocketAddr ,
108
+ handle : & Handle ) -> io:: Result < TcpListener > {
109
+ let l = mio:: net:: TcpListener :: from_listener ( listener, addr) ? ;
110
110
TcpListener :: new ( l, handle)
111
111
}
112
112
@@ -252,9 +252,10 @@ impl TcpStream {
252
252
/// to a TCP stream ready to be used with the provided event loop handle.
253
253
/// The stream returned is associated with the event loop and ready to
254
254
/// perform I/O.
255
- pub fn from_stream ( stream : net:: TcpStream , handle : & Handle )
256
- -> io:: Result < TcpStream > {
257
- let inner = try!( mio:: net:: TcpStream :: from_stream ( stream) ) ;
255
+ pub fn from_std ( stream : net:: TcpStream , handle : & Handle )
256
+ -> io:: Result < TcpStream >
257
+ {
258
+ let inner = mio:: net:: TcpStream :: from_stream ( stream) ?;
258
259
Ok ( TcpStream {
259
260
io : try!( PollEvented :: new ( inner, handle) ) ,
260
261
} )
@@ -278,10 +279,11 @@ impl TcpStream {
278
279
/// loop. Note that on Windows you must `bind` a socket before it can be
279
280
/// connected, so if a custom `TcpBuilder` is used it should be bound
280
281
/// (perhaps to `INADDR_ANY`) before this method is called.
281
- pub fn connect_stream ( stream : net:: TcpStream ,
282
- addr : & SocketAddr ,
283
- handle : & Handle )
284
- -> Box < Future < Item =TcpStream , Error =io:: Error > + Send > {
282
+ pub fn connect_std ( stream : net:: TcpStream ,
283
+ addr : & SocketAddr ,
284
+ handle : & Handle )
285
+ -> Box < Future < Item =TcpStream , Error =io:: Error > + Send >
286
+ {
285
287
let state = match mio:: net:: TcpStream :: connect_stream ( stream, addr) {
286
288
Ok ( tcp) => TcpStream :: new ( tcp, handle) ,
287
289
Err ( e) => TcpStreamNewState :: Error ( e) ,
0 commit comments