[−][src]Struct hyper::client::conn::SendRequest
The sender side of an established connection.
Methods
impl<B> SendRequest<B>
[src]
pub fn poll_ready(&mut self) -> Poll<(), Error>
[src]
Polls to determine whether this sender can be used yet for a request.
If the associated connection is closed, this returns an Error.
impl<B> SendRequest<B> where
B: Stream<Error = Error> + 'static,
B::Item: AsRef<[u8]>,
[src]
B: Stream<Error = Error> + 'static,
B::Item: AsRef<[u8]>,
pub fn send_request(&mut self, req: Request<B>) -> ResponseFuture
[src]
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-formUri
s, since the scheme and authority are need to connect. They aren't required here.- Since the
Client
requires absolute-formUri
s, it can add theHost
header based on it. You must add aHost
header yourself before calling this method. - Since absolute-form
Uri
s are not required, if received, they will be serialized as-is, irregardless of callingRequest::set_proxy
.
Example
use futures::Future; use hyper::{Method, Request}; use hyper::header::Host; // build a Request let path = "/foo/bar".parse().expect("valid path"); let mut req = Request::new(Method::Get, path); req.headers_mut().set(Host::new("hyper.rs", None)); // send it and get a future back let fut = tx.send_request(req) .map(|res| { // got the Response assert!(res.status().is_success()); });
Trait Implementations
Auto Trait Implementations
impl<B> !RefUnwindSafe for SendRequest<B>
impl<B> Send for SendRequest<B> where
B: Send,
B: Send,
impl<B> Sync for SendRequest<B> where
B: Send,
B: Send,
impl<B> Unpin for SendRequest<B>
impl<B> !UnwindSafe for SendRequest<B>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,