Struct Connection
struct Connection<T, S> { ... }
where
S: HttpService<crate::body::Incoming>
A Future representing an HTTP/1 connection, bound to a
Service, returned from
Builder::serve_connection.
To drive HTTP on this connection this future must be polled, typically with
.await. If it isn't polled, no progress will be made on this connection.
Implementations
impl<I, B, S> Connection<I, S>
fn graceful_shutdown(self: Pin<&mut Self>)Start a graceful shutdown process for this connection.
This
Connectionshould continue to be polled until shutdown can finish.Note
This should only be called while the
Connectionfuture is still pending. If called afterConnection::pollhas resolved, this does nothing.fn into_parts(self: Self) -> Parts<I, S>Return the inner IO object, and additional information.
If the IO object has been "rewound" the io will not contain those bytes rewound. This should only be called after
poll_without_shutdownsignals that the connection is "done". Otherwise, it may not have finished flushing all necessary HTTP bytes.Panics
This method will panic if this connection is using an h2 protocol.
fn poll_without_shutdown(self: &mut Self, cx: &mut Context<'_>) -> Poll<crate::Result<()>> where S: Unpin, <S as >::Future: UnpinPoll the connection for completion, but without calling
shutdownon 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.fn without_shutdown(self: Self) -> impl Future<Output = crate::Result<Parts<I, S>>>Prevent shutdown of the underlying IO object at the end of service the request, instead run
into_parts. This is a convenience wrapper overpoll_without_shutdown.Error
This errors if the underlying connection protocol is not HTTP/1.
fn with_upgrades(self: Self) -> UpgradeableConnection<I, S> where I: SendEnable this connection to support higher-level HTTP upgrades.
See the
upgrademodule for more.
impl<'__pin, T, S> Unpin for Connection<T, S>
impl<F> IntoFuture for Connection<T, S>
fn into_future(self: Self) -> <F as IntoFuture>::IntoFuture
impl<F, T, E> TryFuture for Connection<T, S>
fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>
impl<Fut> TryFutureExt for Connection<T, S>
impl<I, B, S> Future for Connection<I, S>
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<<Self as >::Output>
impl<I, S> Debug for Connection<I, S>
fn fmt(self: &Self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl<T> Any for Connection<T, S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Connection<T, S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Connection<T, S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Connection<T, S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FutureExt for Connection<T, S>
impl<T> Instrument for Connection<T, S>
impl<T> WithSubscriber for Connection<T, S>
impl<T, S> Freeze for Connection<T, S>
impl<T, S> RefUnwindSafe for Connection<T, S>
impl<T, S> Send for Connection<T, S>
impl<T, S> Sync for Connection<T, S>
impl<T, S> UnwindSafe for Connection<T, S>
impl<T, U> Into for Connection<T, S>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Connection<T, S>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Connection<T, S>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>