Struct Connection

struct Connection<T, B> { ... }
where
    T: Read + Write,
    B: Body + 'static

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.

Instances of this type are typically created via the handshake function

Implementations

impl<T, B> Connection<T, B>

fn into_parts(self: Self) -> Parts<T>

Return the inner IO object, and additional information.

Only works for HTTP/1 connections. HTTP/2 connections will panic.

fn poll_without_shutdown(self: &mut Self, cx: &mut Context<'_>) -> Poll<crate::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.

async fn without_shutdown(self: Self) -> crate::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.

impl<T, B> Connection<T, B>

fn with_upgrades(self: Self) -> upgrades::UpgradeableConnection<T, B>

Enable this connection to support higher-level HTTP upgrades.

See the upgrade module for more.

impl<F> IntoFuture for Connection<T, B>

fn into_future(self: Self) -> <F as IntoFuture>::IntoFuture

impl<F, T, E> TryFuture for Connection<T, B>

fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>

impl<Fut> TryFutureExt for Connection<T, B>

impl<T> Any for Connection<T, B>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Connection<T, B>

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

impl<T> BorrowMut for Connection<T, B>

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

impl<T> From for Connection<T, B>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FutureExt for Connection<T, B>

impl<T> Instrument for Connection<T, B>

impl<T> WithSubscriber for Connection<T, B>

impl<T, B> Debug for Connection<T, B>

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

impl<T, B> Freeze for Connection<T, B>

impl<T, B> Future for Connection<T, B>

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<<Self as >::Output>

impl<T, B> RefUnwindSafe for Connection<T, B>

impl<T, B> Send for Connection<T, B>

impl<T, B> Sync for Connection<T, B>

impl<T, B> Unpin for Connection<T, B>

impl<T, B> UnwindSafe for Connection<T, B>

impl<T, U> Into for Connection<T, 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 Connection<T, B>

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

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

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