pub struct Connection<T, B>where
T: AsyncRead + AsyncWrite + Send + 'static,
B: HttpBody + 'static,{ /* private fields */ }
Expand description
A future that processes all HTTP state for the IO object.
In most cases, this should just be spawned into an executor, so that it can process incoming and outgoing messages, notice hangups, and the like.
Implementations
sourceimpl<T, B> Connection<T, B>where
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
B: HttpBody + Unpin + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
impl<T, B> Connection<T, B>where
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
B: HttpBody + Unpin + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
sourcepub fn into_parts(self) -> Parts<T>
pub fn into_parts(self) -> Parts<T>
Return the inner IO object, and additional information.
Only works for HTTP/1 connections. HTTP/2 connections will panic.
sourcepub fn poll_without_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
pub fn poll_without_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Poll the connection for completion, but without calling shutdown
on the underlying IO.
This is useful to allow running a connection while doing an HTTP
upgrade. Once the upgrade is completed, the connection would be “done”,
but it is not desired to actually shutdown the IO object. Instead you
would take it back using into_parts
.
Use poll_fn
and try_ready!
to work with this function; or use the without_shutdown
wrapper.
sourcepub fn without_shutdown(self) -> impl Future<Output = Result<Parts<T>>>
pub fn without_shutdown(self) -> impl Future<Output = Result<Parts<T>>>
Prevent shutdown of the underlying IO object at the end of service the request,
instead run into_parts
. This is a convenience wrapper over poll_without_shutdown
.
sourcepub fn http2_is_extended_connect_protocol_enabled(&self) -> bool
pub fn http2_is_extended_connect_protocol_enabled(&self) -> bool
Returns whether the extended CONNECT protocol is enabled or not.
This setting is configured by the server peer by sending the
SETTINGS_ENABLE_CONNECT_PROTOCOL
parameter in a SETTINGS
frame.
This method returns the currently acknowledged value received from the
remote.
Trait Implementations
sourceimpl<T, B> Debug for Connection<T, B>where
T: AsyncRead + AsyncWrite + Debug + Send + 'static,
B: HttpBody + 'static,
impl<T, B> Debug for Connection<T, B>where
T: AsyncRead + AsyncWrite + Debug + Send + 'static,
B: HttpBody + 'static,
sourceimpl<T, B> Future for Connection<T, B>where
T: AsyncRead + AsyncWrite + Unpin + Send,
B: HttpBody + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
impl<T, B> Future for Connection<T, B>where
T: AsyncRead + AsyncWrite + Unpin + Send,
B: HttpBody + Send + 'static,
B::Data: Send,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
Auto Trait Implementations
impl<T, B> !RefUnwindSafe for Connection<T, B>
impl<T, B> Send for Connection<T, B>where
B: Send,
<B as Body>::Data: Send,
impl<T, B> Sync for Connection<T, B>where
B: Send + Sync,
T: Sync,
<B as Body>::Data: Send + Sync,
impl<T, B> Unpin for Connection<T, B>where
T: Unpin,
impl<T, B> !UnwindSafe for Connection<T, B>
Blanket Implementations
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstablefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> FutureExt for Twhere
T: Future + ?Sized,
impl<T> FutureExt for Twhere
T: Future + ?Sized,
sourcefn map<U, F>(self, f: F) -> Map<Self, F>where
F: FnOnce(Self::Output) -> U,
fn map<U, F>(self, f: F) -> Map<Self, F>where
F: FnOnce(Self::Output) -> U,
sourcefn map_into<U>(self) -> MapInto<Self, U>where
Self::Output: Into<U>,
fn map_into<U>(self) -> MapInto<Self, U>where
Self::Output: Into<U>,
sourcefn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>where
F: FnOnce(Self::Output) -> Fut,
Fut: Future,
f
. Read moresourcefn left_future<B>(self) -> Either<Self, B>where
B: Future<Output = Self::Output>,
fn left_future<B>(self) -> Either<Self, B>where
B: Future<Output = Self::Output>,
sourcefn right_future<A>(self) -> Either<A, Self>where
A: Future<Output = Self::Output>,
fn right_future<A>(self) -> Either<A, Self>where
A: Future<Output = Self::Output>,
sourcefn into_stream(self) -> IntoStream<Self>
fn into_stream(self) -> IntoStream<Self>
sourcefn flatten(self) -> Flatten<Self>where
Self::Output: Future,
fn flatten(self) -> Flatten<Self>where
Self::Output: Future,
sourcefn flatten_stream(self) -> FlattenStream<Self>where
Self::Output: Stream,
fn flatten_stream(self) -> FlattenStream<Self>where
Self::Output: Stream,
sourcefn fuse(self) -> Fuse<Self>
fn fuse(self) -> Fuse<Self>
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moresourcefn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnOnce(&Self::Output),
fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnOnce(&Self::Output),
sourcefn catch_unwind(self) -> CatchUnwind<Self>where
Self: UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: UnwindSafe,
sourcefn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)
()
on completion and sends
its output to another future on a separate task. Read moresourcefn boxed<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a, Global>>where
Self: 'a + Send,
fn boxed<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a, Global>>where
Self: 'a + Send,
sourcefn boxed_local<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'a, Global>>where
Self: 'a,
fn boxed_local<'a>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'a, Global>>where
Self: 'a,
sourcefn unit_error(self) -> UnitError<Self>
fn unit_error(self) -> UnitError<Self>
sourcefn never_error(self) -> NeverError<Self>
fn never_error(self) -> NeverError<Self>
sourcefn poll_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output>where
Self: Unpin,
fn poll_unpin(&mut self, cx: &mut Context<'_>) -> Poll<Self::Output>where
Self: Unpin,
Future::poll
on Unpin
future types.sourcefn now_or_never(self) -> Option<Self::Output>
fn now_or_never(self) -> Option<Self::Output>
Future::poll
. Read more