pub struct H2Connection { /* private fields */ }Expand description
The HTTP/2 connection handle. Cheap to clone (shares one Rc state).
Implementations§
Source§impl H2Connection
impl H2Connection
Sourcepub fn active_streams(&self) -> usize
pub fn active_streams(&self) -> usize
Client-initiated streams currently open or half-closed — the ones that count toward the peer’s SETTINGS_MAX_CONCURRENT_STREAMS (§5.1.2).
Sourcepub fn can_open_stream(&self) -> bool
pub fn can_open_stream(&self) -> bool
True if a new request would stay within the peer’s advertised
SETTINGS_MAX_CONCURRENT_STREAMS. A connection pool uses this to decide
whether to route here or open a fresh connection; a direct caller need not
check — request parks until a slot frees.
Sourcepub async fn request(&self, init: RequestInit) -> Result<Response, H2Error>
pub async fn request(&self, init: RequestInit) -> Result<Response, H2Error>
The negotiated WebSocket subprotocol, if opened via a WebSocket (set by the caller). Empty otherwise.
Trait Implementations§
Source§impl Clone for H2Connection
impl Clone for H2Connection
Source§fn clone(&self) -> H2Connection
fn clone(&self) -> H2Connection
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PoolConnection for H2Connection
impl PoolConnection for H2Connection
Source§fn can_open_stream(&self) -> bool
fn can_open_stream(&self) -> bool
Whether a new request would stay within the peer’s advertised
SETTINGS_MAX_CONCURRENT_STREAMS.
Source§fn request(
&self,
init: RequestInit,
) -> LocalBoxFuture<'static, Result<Response, H2Error>>
fn request( &self, init: RequestInit, ) -> LocalBoxFuture<'static, Result<Response, H2Error>>
Issue a request on this connection.
Auto Trait Implementations§
impl !RefUnwindSafe for H2Connection
impl !Send for H2Connection
impl !Sync for H2Connection
impl !UnwindSafe for H2Connection
impl Freeze for H2Connection
impl Unpin for H2Connection
impl UnsafeUnpin for H2Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more