Struct Connection

#[must_use = "futures do nothing unless polled"]
pub struct Connection<T, S, E>
where
    S: HttpService<Incoming>, { /* private fields */ }

A Future representing an HTTP/2 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, E> 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: Http2ServerConnExec<S::Future, B>,

fn graceful_shutdown(self: Pin<&mut Self>)

Start a graceful shutdown process for this connection.

This Connection should continue to be polled until shutdown can finish.

Note

This should only be called while the Connection future is still pending. If called after Connection::poll has resolved, this does nothing.

Trait Implementations

impl<'__pin, T, S, E> Unpin for Connection<T, S, E> where PinnedFieldsOf<__Origin<'__pin, T, S, E>>: Unpin, S: HttpService<IncomingBody>,

impl<I, B, S, E> Future for 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: Http2ServerConnExec<S::Future, B>,

type Output = Result<(), Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

impl<I, S, E> Debug for Connection<I, S, E> where S: HttpService<Incoming>,

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

Auto Trait Implementations

impl<T, S, E> !Freeze for Connection<T, S, E>

impl<T, S, E> !RefUnwindSafe for Connection<T, S, E>

impl<T, S, E> !UnwindSafe for Connection<T, S, E>

impl<T, S, E> Send for Connection<T, S, E> where Server<T, S, <S as HttpService<Incoming>>::ResBody, E>: Send,

impl<T, S, E> Sync for Connection<T, S, E> where Server<T, S, <S as HttpService<Incoming>>::ResBody, E>: Sync,

impl<T, S, E> UnsafeUnpin for Connection<T, S, E> where Server<T, S, <S as HttpService<Incoming>>::ResBody, E>: UnsafeUnpin,

Blanket Implementations

impl<F> IntoFuture for Connection<T, 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<T, 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<T> Any for Connection<T, S, E> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Connection<T, S, E> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Connection<T, S, E> where T: ?Sized,

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

impl<T> From<T> for Connection<T, S, E>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> FutureExt for Connection<T, S, E> where T: Future + ?Sized,

impl<T> Instrument for Connection<T, S, E>

impl<T> WithSubscriber for Connection<T, S, E>

impl<T, U> Into<U> for Connection<T, S, E> where U: From<T>,

fn into(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<U> for Connection<T, S, E> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Connection<T, S, E> where U: TryFrom<T>,

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