[][src]Struct hyper::client::conn::Connection

#[must_use = "futures do nothing unless polled"]pub struct Connection<T, B> where
    T: AsyncRead + AsyncWrite + Send + 'static,
    B: HttpBody + 'static, 
{ /* fields omitted */ }

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

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>>, 
[src]

pub fn into_parts(self) -> Parts<T>[src]

Return the inner IO object, and additional information.

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

pub fn poll_without_shutdown(
    &mut self,
    cx: &mut Context<'_>
) -> Poll<Result<()>>
[src]

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.

pub fn without_shutdown(self) -> impl Future<Output = Result<Parts<T>>>[src]

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.

Trait Implementations

impl<T, B> Debug for Connection<T, B> where
    T: AsyncRead + AsyncWrite + Debug + Send + 'static,
    B: HttpBody + 'static, 
[src]

impl<T, B> Future for Connection<T, B> where
    T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
    B: HttpBody + Send + 'static,
    B::Data: Send,
    B::Error: Into<Box<dyn StdError + Send + Sync>>, 
[src]

type Output = Result<()>

The type of value produced on completion.

Auto Trait Implementations

impl<T, B> !RefUnwindSafe for Connection<T, B>[src]

impl<T, B> Send for Connection<T, B> where
    B: Send,
    <B as Body>::Data: Send
[src]

impl<T, B> Sync for Connection<T, B> where
    B: Send + Sync,
    T: Sync,
    <B as Body>::Data: Sync
[src]

impl<T, B> Unpin for Connection<T, B> where
    T: Unpin
[src]

impl<T, B> !UnwindSafe for Connection<T, B>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized
[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.