pub struct H2Pool { /* private fields */ }Expand description
A pool of HTTP/2 connections. Cheap to clone (shares one Rc state).
Implementations§
Source§impl H2Pool
impl H2Pool
Sourcepub fn new<F, Fut>(factory: F, max_connections: usize) -> Self
pub fn new<F, Fut>(factory: F, max_connections: usize) -> Self
Build a pool from a connection factory (each call opens a fresh
connection). max_connections caps how many connections are opened
(usize::MAX for unbounded); past the cap, requests park on an existing
connection (which queues them internally until a stream slot frees).
Sourcepub async fn request(&self, init: RequestInit) -> Result<Response, H2Error>
pub async fn request(&self, init: RequestInit) -> Result<Response, H2Error>
Route a request to a connection with a free stream slot, opening a new connection if all existing ones are saturated.
Sourcepub fn connections(&self) -> usize
pub fn connections(&self) -> usize
The number of live connections currently in the pool.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for H2Pool
impl !Send for H2Pool
impl !Sync for H2Pool
impl !UnwindSafe for H2Pool
impl Freeze for H2Pool
impl Unpin for H2Pool
impl UnsafeUnpin for H2Pool
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