HTTP Client Pool
High-level pool of HTTP clients that currently only supports HTTP/2. Allows multiple connections that can be referenced in concurrent scenarios.
To use this functionality, it is necessary to activate the http-client-pool
feature.
Example
//! Fetches and prints the response body of a provided URI. //! //! This snippet requires ~25 dependencies and has an optimized binary size of ~700K. //! //! Currently, only HTTP/2 is supported. extern crate tokio; extern crate wtx; extern crate wtx_instances; use wtx::{ http::{HttpClient, Method, ReqResBuffer, client_pool::ClientPoolBuilder}, misc::{Uri, from_utf8_basic}, }; #[tokio::main] async fn main() -> wtx::Result<()> { let uri = Uri::new("SOME_URI"); let mut pool = ClientPoolBuilder::tokio(1).build(); let res = pool.send_recv_single(Method::Get, ReqResBuffer::empty(), &uri).await?; println!("{}", from_utf8_basic(&res.rrd.body)?); Ok(()) }