pub struct SendRequest<B> { /* private fields */ }
client
and (crate features http1
or http2
) only.Expand description
The sender side of an established connection.
Implementations§
Source§impl<B> SendRequest<B>
impl<B> SendRequest<B>
Sourcepub fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<()>>
Polls to determine whether this sender can be used yet for a request.
If the associated connection is closed, this returns an Error.
Sourcepub async fn ready(&mut self) -> Result<()>
pub async fn ready(&mut self) -> Result<()>
Waits until the dispatcher is ready
If the associated connection is closed, this returns an Error.
Sourcepub fn is_ready(&self) -> bool
pub fn is_ready(&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.
Source§impl<B> SendRequest<B>where
B: Body + 'static,
impl<B> SendRequest<B>where
B: Body + 'static,
Sourcepub fn send_request(
&mut self,
req: Request<B>,
) -> impl Future<Output = Result<Response<IncomingBody>>>
pub fn send_request( &mut self, req: Request<B>, ) -> impl Future<Output = 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.
Absolute-form Uri
s are not required. If received, they will be serialized
as-is.
Sourcepub fn try_send_request(
&mut self,
req: Request<B>,
) -> impl Future<Output = Result<Response<IncomingBody>, TrySendError<Request<B>>>>
pub fn try_send_request( &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.
Trait Implementations§
Source§impl<B> Clone for SendRequest<B>
impl<B> Clone for SendRequest<B>
Source§fn clone(&self) -> SendRequest<B>
fn clone(&self) -> SendRequest<B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<B> Freeze for SendRequest<B>
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes