pub fn send_request(&mut self, req: Request<B>) -> ResponseFuture {
        let inner = match self.dispatch.send(req) {
            Ok(rx) => {
                Either::A(rx.then(move |res| {
                    match res {
                        Ok(Ok(res)) => Ok(res),
                        Ok(Err(err)) => Err(err),
                        // this is definite bug if it happens, but it shouldn't happen!
                        Err(_) => panic!("dispatch dropped without returning error"),
                    }
                }))
            },
            Err(_req) => {
                debug!("connection was not ready");
                let err = ::Error::new_canceled().with("connection was not ready");
                Either::B(future::err(err))
            }
        };

        ResponseFuture {
            inner: Box::new(inner),
        }
    }
/// Sends a `Request` on the associated connection.
///
/// Returns a future that if successful, yields the `Response`.
///
/// # Note
///
/// There are some key differences in what automatic things the `Client`
/// does for you that will not be done here:
///
/// - `Client` requires absolute-form `Uri`s, since the scheme and
///   authority are needed to connect. They aren't required here.
/// - Since the `Client` requires absolute-form `Uri`s, it can add
///   the `Host` header based on it. You must add a `Host` header yourself
///   before calling this method.
/// - Since absolute-form `Uri`s are not required, if received, they will
///   be serialized as-is.
///
/// # Example
///
/// ```
/// # extern crate futures;
/// # extern crate hyper;
/// # extern crate http;
/// # use http::header::HOST;
/// # use hyper::client::conn::SendRequest;
/// # use hyper::Body;
/// use futures::Future;
/// use hyper::Request;
///
/// # fn doc(mut tx: SendRequest<Body>) {
/// // build a Request
/// let req = Request::builder()
///     .uri("/foo/bar")
///     .header(HOST, "hyper.rs")
///     .body(Body::empty())
///     .unwrap();
///
/// // send it and get a future back
/// let fut = tx.send_request(req)
///     .map(|res| {
///         // got the Response
///         assert!(res.status().is_success());
///     });
/// # drop(fut);
/// # }
/// # fn main() {}
/// ```
Sends a `Request` on the associated connection.
Returns a future that if successful, yields the `Response`.
Sends a ` Request ` on the associated connection . Returns a future that if successful yields the ` Response ` .
pub fn send_request(&mut self, req: Request<B>) -> ResponseFuture {
        let inner = match self.dispatch.send(req) {
            Ok(rx) => {
                Either::A(rx.then(move |res| {
                    match res {
                        Ok(Ok(res)) => Ok(res),
                        Ok(Err(err)) => Err(err),
                        // this is definite bug if it happens, but it shouldn't happen!
                        Err(_) => panic!("dispatch dropped without returning error"),
                    }
                }))
            },
            Err(_req) => {
                debug!("connection was not ready");
                let err = ::Error::new_canceled().with("connection was not ready");
                Either::B(future::err(err))
            }
        };
        ResponseFuture {
            inner: Box::new(inner),
        }
    }
pub fn send_request ( & mut self , req : Request < B > ) -> ResponseFuture { let inner = match self . dispatch . send ( req ) { Ok ( rx ) => { Either :: A ( rx . then ( move | res | { match res { Ok ( Ok ( res ) ) => Ok ( res ) , Ok ( Err ( err ) ) => Err ( err ) , // this is definite bug if it happens, but it shouldn't happen! Err ( _ ) => panic ! ( " " ) , } } ) ) } , Err ( _req ) => { debug ! ( " " ) ; let err = :: Error :: new_canceled ( ) . with ( " " ) ; Either :: B ( future :: err ( err ) ) } } ; ResponseFuture { inner : Box :: new ( inner ) , } }
Sends a `Request` on the associated connection.
Sends a ` Request ` on the associated connection .
&mut self
req
Request<B>
&mut self
req
Request<B>
note
There are some key differences in what automatic things the `Client`
does for you that will not be done here.

`Client` requires absolute-form `Uri`s, since the scheme and
authority are needed to connect. They aren't required here.
Since the `Client` requires absolute-form `Uri`s, it can add
the `Host` header based on it. You must add a `Host` header yourself
before calling this method.
Since absolute-form `Uri`s are not required, if received, they will
be serialized as-is.
There are some key differences in what automatic things the ` Client ` does for you that will not be done here . ` Client ` requires absolute - form ` Uri ` s since the scheme and authority are needed to connect . They aren ' t required here . Since the ` Client ` requires absolute - form ` Uri ` s it can add the ` Host ` header based on it . You must add a ` Host ` header yourself before calling this method . Since absolute - form ` Uri ` s are not required if received they will be serialized as - is .
example
None
extern crate futures;
None
extern crate hyper;
None
extern crate http;
None
use http::header::host;
None
use hyper::client::conn::sendrequest;
None
use hyper::body;
use futures::Future;
use hyper::Request.
use futures :: Future ; use hyper :: Request .
fn doc(mut tx: sendrequest<body>) {
build a Request
let req = Request::builder()
.uri("/foo/bar")
.header(HOST, "hyper.rs")
.body(Body::empty())
.unwrap().

send it and get a future back
let fut = tx.send_request(req)
.map(|res| {
got the Response
assert!(res.status().is_success());
}).
build a Request let req = Request :: builder () . uri ( " / foo / bar " ) . header ( HOST " hyper . rs " ) . body ( Body :: empty () ) . unwrap () . send it and get a future back let fut = tx . send_request ( req ) . map ( |res| { got the Response assert! ( res . status () . is_success () ) ; } ) .
drop(fut);
None
}
None
fn main() {}
None