Struct SendRequest

struct SendRequest<B> { ... }

The sender side of an established connection.

Implementations

impl<B> SendRequest<B>

fn send_request(self: &mut Self, req: Request<B>) -> impl Future<Output = crate::Result<Response<IncomingBody>>>

Sends a Request on the associated connection.

Returns a future that if successful, yields the Response.

req must have a Host header.

Uri

The Uri of the request is serialized as-is.

  • Usually you want origin-form (/path?query).
  • For sending to an HTTP proxy, you want to send in absolute-form (https://hyper.rs/guides).

This is however not enforced or validated and it is up to the user of this method to ensure the Uri is correct for their intended purpose.

fn try_send_request(self: &mut Self, req: Request<B>) -> impl Future<Output = Result<Response<IncomingBody>, TrySendError<Request<B>>>>

Sends a Request on the associated connection.

Returns a future that if successful, yields the Response.

Error

If there was an error before trying to serialize the request to the connection, the message will be returned as part of this error.

impl<B> SendRequest<B>

fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<crate::Result<()>>

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

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

async fn ready(self: &mut Self) -> crate::Result<()>

Waits until the dispatcher is ready

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

fn is_ready(self: &Self) -> bool

Checks if the connection is currently ready to send a request.

Note

This is mostly a hint. Due to inherent latency of networks, it is possible that even after checking this is ready, sending a request may still fail because the connection was closed in the meantime.

fn is_closed(self: &Self) -> bool

Checks if the connection side has been closed.

impl<B> Debug for SendRequest<B>

fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result

impl<B> Freeze for SendRequest<B>

impl<B> RefUnwindSafe for SendRequest<B>

impl<B> Send for SendRequest<B>

impl<B> Sync for SendRequest<B>

impl<B> Unpin for SendRequest<B>

impl<B> UnwindSafe for SendRequest<B>

impl<T> Any for SendRequest<B>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for SendRequest<B>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for SendRequest<B>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for SendRequest<B>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for SendRequest<B>

impl<T> WithSubscriber for SendRequest<B>

impl<T, U> Into for SendRequest<B>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for SendRequest<B>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for SendRequest<B>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>