Struct hyper::client::conn::SendRequest
source · pub struct SendRequest<B> {
dispatch: Sender<Request<B>, Response<Body>>,
}
Expand description
The sender side of an established connection.
Fields§
§dispatch: Sender<Request<B>, Response<Body>>
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.
pub(super) async fn when_ready(self) -> Result<Self>
pub(super) fn is_ready(&self) -> bool
pub(super) fn is_closed(&self) -> bool
pub(super) fn into_http2(self) -> Http2SendRequest<B>
source§impl<B> SendRequest<B>where
B: HttpBody + 'static,
impl<B> SendRequest<B>where
B: HttpBody + 'static,
sourcepub fn send_request(&mut self, req: Request<B>) -> ResponseFuture ⓘ
pub fn send_request(&mut self, req: Request<B>) -> ResponseFuture ⓘ
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 needed 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.
§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());
pub(super) fn send_request_retryable(
&mut self,
req: Request<B>,
) -> impl Future<Output = Result<Response<Body>, (Error, Option<Request<B>>)>> + Unpinwhere
B: Send,
Trait Implementations§
source§impl<B> Debug for SendRequest<B>
impl<B> Debug for SendRequest<B>
source§impl<B> Service<Request<B>> for SendRequest<B>where
B: HttpBody + 'static,
impl<B> Service<Request<B>> for SendRequest<B>where
B: HttpBody + 'static,
Auto 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
Mutably borrows from an owned value. Read more