Struct Connection
#[must_use = "futures do nothing unless polled"]
pub struct Connection<'a, I, S, E>
where
S: HttpService<Incoming>, { /* private fields */ }
A Future representing an HTTP/1 connection, 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, S, E, B> Connection<'_, I, S, E>
where
S: HttpService<Incoming, ResBody = B>,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
I: Read + Write + Unpin,
B: Body + 'static,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
E: HttpServerConnExec<S::Future, B>,
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_owned(self) -> Connection<'static, I, S, E> where Builder<E>: Clone,Make this Connection static, instead of borrowing from Builder.
Trait Implementations
impl<'__pin, 'a, I, S, E> Unpin for Connection<'a, I, S, E>
where
PinnedFieldsOf<__Origin<'__pin, 'a, I, S, E>>: Unpin,
S: HttpService<Incoming>,
impl<I, S, E, B> Future for Connection<'_, I, S, E>
where
S: Service<Request<Incoming>, Response = Response<B>>,
S::Future: 'static,
S::Error: Into<Box<dyn StdError + Send + Sync>>,
B: Body + 'static,
B::Error: Into<Box<dyn StdError + Send + Sync>>,
I: Read + Write + Unpin + 'static,
E: HttpServerConnExec<S::Future, B>,
type Output = Result<(), Box<dyn Error + Sync + Send>>;fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
Auto Trait Implementations
impl<'a, I, S, E> !Freeze for Connection<'a, I, S, E>
impl<'a, I, S, E> !RefUnwindSafe for Connection<'a, I, S, E>
impl<'a, I, S, E> !UnsafeUnpin for Connection<'a, I, S, E>
impl<'a, I, S, E> !UnwindSafe for Connection<'a, I, S, E>
impl<'a, I, S, E> Send for Connection<'a, I, S, E>
where
ConnState<'a, I, S, E>: Send,
impl<'a, I, S, E> Sync for Connection<'a, I, S, E>
where
ConnState<'a, I, S, E>: Sync,
Blanket Implementations
impl<F> IntoFuture for Connection<'a, I, S, E>
where
F: Future,
type Output = <F as Future>::Output;type IntoFuture = F;fn into_future(self) -> <F as IntoFuture>::IntoFuture
impl<F, T, E> TryFuture for Connection<'a, I, S, E>
where
F: Future<Output = Result<T, E>> + ?Sized,
type Ok = T;type Error = E;fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>
impl<Fut> TryFutureExt for Connection<'a, I, S, E>
where
Fut: TryFuture + ?Sized,
impl<T> Any for Connection<'a, I, S, E>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Connection<'a, I, S, E>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Connection<'a, I, S, E>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Connection<'a, I, S, E>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FutureExt for Connection<'a, I, S, E>
where
T: Future + ?Sized,
impl<T> FutureExt for Connection<'a, I, S, E>
where
T: Future + ?Sized,
impl<T> Instrument for Connection<'a, I, S, E>
impl<T> WithSubscriber for Connection<'a, I, S, E>
impl<T, U> Into<U> for Connection<'a, I, S, E>
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 Connection<'a, I, S, E>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Connection<'a, I, S, E>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>