[−][src]Trait hyper::net::NetworkConnector
A connector creates a NetworkStream.
Associated Types
type Stream: Into<Box<dyn NetworkStream + Send>>
Type of Stream
to create
Required Methods
fn connect(&self, host: &str, port: u16, scheme: &str) -> Result<Self::Stream>
Connect to a remote address.
Implementors
impl NetworkConnector for HttpConnector
[src]
impl NetworkConnector for HttpConnector
type Stream = HttpStream
fn connect(&self, host: &str, port: u16, scheme: &str) -> Result<HttpStream>
[src]
fn connect(&self, host: &str, port: u16, scheme: &str) -> Result<HttpStream>
impl<C: NetworkConnector<Stream = S>, S: NetworkStream + Send> NetworkConnector for Pool<C>
[src]
impl<C: NetworkConnector<Stream = S>, S: NetworkStream + Send> NetworkConnector for Pool<C>
type Stream = PooledStream<S>
fn connect(
&self,
host: &str,
port: u16,
scheme: &str
) -> Result<PooledStream<S>>
[src]
fn connect(
&self,
host: &str,
port: u16,
scheme: &str
) -> Result<PooledStream<S>>
impl<F> NetworkConnector for F where
F: Fn(&str, u16, &str) -> Result<TcpStream>,
[src]
impl<F> NetworkConnector for F where
F: Fn(&str, u16, &str) -> Result<TcpStream>,
A closure as a connector used to generate TcpStream
s per request
Example
Basic example:
Client::with_connector(|addr: &str, port: u16, scheme: &str| {
TcpStream::connect(&(addr, port))
});
Example using TcpBuilder
from the net2 crate if you want to configure your source socket:
Client::with_connector(|addr: &str, port: u16, scheme: &str| {
let b = try!(TcpBuilder::new_v4());
try!(b.bind("127.0.0.1:0"));
b.connect(&(addr, port))
});
type Stream = HttpStream
fn connect(&self, host: &str, port: u16, scheme: &str) -> Result<HttpStream>
[src]
fn connect(&self, host: &str, port: u16, scheme: &str) -> Result<HttpStream>
impl<S: SslClient, C: NetworkConnector<Stream = HttpStream>> NetworkConnector for HttpsConnector<S, C>
[src]
impl<S: SslClient, C: NetworkConnector<Stream = HttpStream>> NetworkConnector for HttpsConnector<S, C>