Created
July 28, 2015 20:22
-
-
Save muja/5a0bb173372cfe71dfa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl<F> NetworkConnector for F where F: Fn(&str, u16, &str) -> io::Result<TcpStream> { | |
type Stream = HttpStream; | |
fn connect(&self, host: &str, port: u16, scheme: &str) -> ::Result<HttpStream> { | |
Ok(HttpStream(try!((*self)(host, port, scheme)))) | |
} | |
} | |
impl<F> NetworkConnector for F where F: Fn(&str, u16) -> io::Result<TcpStream> { | |
type Stream = HttpStream; | |
fn connect(&self, host: &str, port: u16, _scheme: &str) -> ::Result<HttpStream> { | |
Ok(HttpStream(try!((*self)(host, port)))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment