# Struct hyper::client::conn::SendRequest [−] [src]

    pub struct SendRequest<B> { /* fields omitted */ }

The sender side of an established connection.

## Implementations

### `impl<B> SendRequest<B>` [src]

#### `pub fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>` [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: HttpBody + 'static,` [src]

#### `pub fn send_request(&mut self, req: Request<B>) -> ResponseFutureⓘ

### Notable traits for ResponseFuture

`impl Future for ResponseFuture type Output = Result<Response<Body>>;`
` [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-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

    use hyper::Request;

    // build a Request
    let req = Request::builder()
        .uri("/foo/bar")
        .header(HOST, "hyper.rs")
        .body(Body::empty())
        .unwrap();

    // send it and await a Response
    let res = tx.send_request(req).await?;
    // assert the Response
    assert!(res.status().is_success());

## Trait Implementations

### `impl<B> Debug for SendRequest<B>` [src]

#### `fn fmt(&self, f: &mut Formatter<'_>) -> Result` [src]

Formats the value using the given formatter. Read more

### `impl<B> Service<Request<B>> for SendRequest<B> where
B: HttpBody + 'static,` [src]

#### `type Response = Response<Body>`

Responses given by the service.

#### `type Error = Error`

Errors produced by the service.

#### `type Future = ResponseFuture`

The future response value.

#### `fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>` [src]

Returns `Poll::Ready(Ok(()))` when the service is able to process requests. Read more

#### `fn call(&mut self, req: Request<B>) -> Self::Future` [src]

Process the request and return the response asynchronously. Read more

## Auto Trait Implementations

### `impl<B> !RefUnwindSafe for SendRequest<B>`

### `impl<B> Send for SendRequest<B> where
B: Send,`

### `impl<B> Sync for SendRequest<B> where
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]

#### `pub fn type_id(&self) -> TypeId` [src]

Gets the `TypeId` of `self`. Read more

### `impl<T> Borrow<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow(&self) -> &T` [src]

Immutably borrows from an owned value. Read more

### `impl<T> BorrowMut<T> for T where
T: ?Sized,` [src]

#### `pub fn borrow_mut(&mut self) -> &mut T` [src]

Mutably borrows from an owned value. Read more

### `impl<T> From<T> for T` [src]

#### `pub fn from(t: T) -> T` [src]

Performs the conversion.

### `impl<T> Instrument for T` [src]

#### `pub fn instrument(self, span: Span) -> Instrumented<Self>` [src]

Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. Read more

#### `pub fn in_current_span(self) -> Instrumented<Self>` [src]

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more

### `impl<T, U> Into<U> for T where
U: From<T>,` [src]

#### `pub fn into(self) -> U` [src]

Performs the conversion.

### `impl<T, U> TryFrom<U> for T where
U: Into<T>,` [src]

#### `type Error = Infallible`

The type returned in the event of a conversion error.

#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` [src]

Performs the conversion.

### `impl<T, U> TryInto<U> for T where
U: TryFrom<T>,` [src]

#### `type Error = <U as TryFrom<T>>::Error`

The type returned in the event of a conversion error.

#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` [src]

Performs the conversion.