pub struct SendRequest<B> { /* private fields */ }
Expand description

The sender side of an established connection.

Implementations

Polls to determine whether this sender can be used yet for a request.

If the associated connection is closed, this returns an Error.

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 Uris, since the scheme and authority are needed to connect. They aren’t required here.
  • Since the Client requires absolute-form Uris, it can add the Host header based on it. You must add a Host header yourself before calling this method.
  • Since absolute-form Uris 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

Formats the value using the given formatter. Read more

Responses given by the service.

Errors produced by the service.

The future response value.

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

Process the request and return the response asynchronously. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more