Struct Connection
#[must_use = "futures do nothing unless polled"]
pub struct Connection<T, B, E>
where
T: Read + Write + Unpin,
B: Body + 'static,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn Error + Send + Sync>>, { /* private fields */ }
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.
Drop behavior
Dropping the Connection will close the underlying IO resource.
Any in-flight requests that have not received a response will be
interrupted. If graceful shutdown is desired, poll the connection
until it completes instead of dropping.
Implementations
impl<T, B, E> Connection<T, B, E>
where
T: Read + Write + Unpin + 'static,
B: Body + Unpin + 'static,
B::Data: Send,
B::Error: Into<Box<dyn Error + Send + Sync>>,
E: Http2ClientConnExec<B, T> + Unpin,
fn is_extended_connect_protocol_enabled(&self) -> boolReturns whether the extended CONNECT protocol is enabled or not.
This setting is configured by the server peer by sending the
SETTINGS_ENABLE_CONNECT_PROTOCOLparameter in aSETTINGSframe. This method returns the currently acknowledged value received from the remote.fn current_max_send_streams(&self) -> usizeReturns the current maximum send stream count.
This setting is configured in a
SETTINGS_MAX_CONCURRENT_STREAMSparameter in aSETTINGSframe, and may change throughout the connection lifetime.fn current_max_recv_streams(&self) -> usizeReturns the current maximum receive stream count.
This setting is configured in a
SETTINGS_MAX_CONCURRENT_STREAMSparameter in aSETTINGSframe, and may change throughout the connection lifetime.
Trait Implementations
impl<T, B, E> Debug for Connection<T, B, E>
where
T: Read + Write + Debug + 'static + Unpin,
B: Body + 'static,
E: Http2ClientConnExec<B, T> + Unpin,
B::Error: Into<Box<dyn Error + Send + Sync>>,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T, B, E> Future for Connection<T, B, E>
where
T: Read + Write + Unpin + 'static,
B: Body + 'static + Unpin,
B::Data: Send,
E: Unpin + Http2ClientConnExec<B, T>,
B::Error: Into<Box<dyn Error + Send + Sync>>,
type Output = Result<(), Error>;fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>
Auto Trait Implementations
impl<T, B, E> !RefUnwindSafe for Connection<T, B, E>
impl<T, B, E> !UnwindSafe for Connection<T, B, E>
impl<T, B, E> Freeze for Connection<T, B, E>
where
<B as Body>::Error: Sized,
(PhantomData<T>, ClientTask<B, E, T>): Freeze,
impl<T, B, E> Send for Connection<T, B, E>
where
<B as Body>::Error: Sized,
(PhantomData<T>, ClientTask<B, E, T>): Send,
impl<T, B, E> Sync for Connection<T, B, E>
where
<B as Body>::Error: Sized,
(PhantomData<T>, ClientTask<B, E, T>): Sync,
impl<T, B, E> Unpin for Connection<T, B, E>
where
<B as Body>::Error: Sized,
(PhantomData<T>, ClientTask<B, E, T>): Unpin,
impl<T, B, E> UnsafeUnpin for Connection<T, B, E>
where
<B as Body>::Error: Sized,
(PhantomData<T>, ClientTask<B, E, T>): UnsafeUnpin,
Blanket Implementations
impl<F> IntoFuture for Connection<T, B, 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, B, 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, B, E>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Connection<T, B, E>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Connection<T, B, E>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Connection<T, B, E>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FutureExt for Connection<T, B, E>
where
T: Future + ?Sized,
impl<T> Instrument for Connection<T, B, E>
impl<T> WithSubscriber for Connection<T, B, E>
impl<T, U> Into<U> for Connection<T, B, 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<T, B, E>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Connection<T, B, E>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>