Skip to content

Instantly share code, notes, and snippets.

@muja
Created July 28, 2015 18:34
Show Gist options
  • Save muja/96ecec36a7af14650ded to your computer and use it in GitHub Desktop.
Save muja/96ecec36a7af14650ded to your computer and use it in GitHub Desktop.
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))))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment