Struct SendRequest
pub struct SendRequest<B> { /* private fields */ }
The sender side of an established connection.
Implementations
impl<B> SendRequest<B>
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.
async fn ready(&mut self) -> Result<()>Waits until the dispatcher is ready.
If the associated connection is closed, this returns an Error.
fn is_ready(&self) -> boolChecks 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) -> boolChecks if the connection side has been closed.
impl<B> SendRequest<B>
where
B: Body + 'static,
fn send_request(&mut self, req: Request<B>) -> impl Future<Output = Result<Response<IncomingBody>>>Sends a
Requeston the associated connection.Returns a future that if successful, yields the
Response.reqmust have aHostheader.Absolute-form
Uris are not required. If received, they will be serialized as-is.Cancel safety
Dropping the returned future is the supported way to cancel an in-flight HTTP/2 request. The stream is reset with
RST_STREAM(CANCELerror code); the shared connection remains usable for other in-flight and future requests. The peer is notified immediately rather than continuing to send a response body that would be discarded.fn try_send_request(&mut self, req: Request<B>) -> impl Future<Output = Result<Response<IncomingBody>, TrySendError<Request<B>>>>Sends a
Requeston 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
impl<B> Clone for SendRequest<B>
fn clone(&self) -> SendRequest<B>
impl<B> Debug for SendRequest<B>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<B> !RefUnwindSafe for SendRequest<B>
impl<B> !UnwindSafe for SendRequest<B>
impl<B> Freeze for SendRequest<B>
where
UnboundedSender<Request<B>, Response<Incoming>>: Freeze,
impl<B> Send for SendRequest<B>
where
UnboundedSender<Request<B>, Response<Incoming>>: Send,
impl<B> Sync for SendRequest<B>
where
UnboundedSender<Request<B>, Response<Incoming>>: Sync,
impl<B> Unpin for SendRequest<B>
where
UnboundedSender<Request<B>, Response<Incoming>>: Unpin,
impl<B> UnsafeUnpin for SendRequest<B>
where
UnboundedSender<Request<B>, Response<Incoming>>: UnsafeUnpin,
Blanket Implementations
impl<T> Any for SendRequest<B>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for SendRequest<B>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for SendRequest<B>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for SendRequest<B>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for SendRequest<B>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for SendRequest<B>
impl<T> ToOwned for SendRequest<B>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for SendRequest<B>
impl<T, U> Into<U> for SendRequest<B>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for SendRequest<B>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for SendRequest<B>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>