pub struct Connection<T, B>{ /* private fields */ }Expand description
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§
Source§impl<T, B> Connection<T, B>
impl<T, B> Connection<T, B>
Sourcepub fn into_parts(self) -> Parts<T>
pub fn into_parts(self) -> Parts<T>
Return the inner IO object, and additional information.
Only works for HTTP/1 connections. HTTP/2 connections will panic.
Sourcepub fn poll_without_shutdown(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<()>>
pub fn poll_without_shutdown( &mut self, cx: &mut Context<'_>, ) -> Poll<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.
Sourcepub async fn without_shutdown(self) -> Result<Parts<T>>
pub async fn without_shutdown(self) -> 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.