File tree Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Expand file tree Collapse file tree 2 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 1+ use http_client:: HttpClient ;
2+ use http_types:: { Method , Request } ;
3+
4+ #[ cfg( any( feature = "h1_client" , feature = "docs" ) ) ]
5+ use http_client:: h1:: H1Client as Client ;
6+ #[ cfg( all( feature = "hyper_client" , not( feature = "docs" ) ) ) ]
7+ use http_client:: hyper:: HyperClient as Client ;
8+ #[ cfg( all( feature = "curl_client" , not( feature = "docs" ) ) ) ]
9+ use http_client:: isahc:: IsahcClient as Client ;
10+ #[ cfg( all( feature = "wasm_client" , not( feature = "docs" ) ) ) ]
11+ use http_client:: wasm:: WasmClient as Client ;
12+
13+ #[ async_std:: main]
14+ async fn main ( ) {
15+ let client = Client :: new ( ) ;
16+
17+ let req = Request :: new ( Method :: Get , "http://example.org" ) ;
18+
19+ client. send ( req) . await . unwrap ( ) ;
20+
21+ dbg ! ( client) ;
22+ }
Original file line number Diff line number Diff line change @@ -37,7 +37,40 @@ pub struct H1Client {
3737
3838impl Debug for H1Client {
3939 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
40- f. write_str ( "H1Client" )
40+ f. debug_struct ( "H1Client" )
41+ . field (
42+ "http_pools" ,
43+ & self
44+ . http_pools
45+ . iter ( )
46+ . map ( |pool| {
47+ let status = pool. status ( ) ;
48+ format ! (
49+ "Connections: {}, Available: {}, Max: {}" ,
50+ status. size, status. available, status. max_size
51+ )
52+ } )
53+ . collect :: < Vec < String > > ( ) ,
54+ )
55+ . field (
56+ "https_pools" ,
57+ & self
58+ . http_pools
59+ . iter ( )
60+ . map ( |pool| {
61+ let status = pool. status ( ) ;
62+ format ! (
63+ "Connections: {}, Available: {}, Max: {}" ,
64+ status. size, status. available, status. max_size
65+ )
66+ } )
67+ . collect :: < Vec < String > > ( ) ,
68+ )
69+ . field (
70+ "max_concurrent_connections" ,
71+ & self . max_concurrent_connections ,
72+ )
73+ . finish ( )
4174 }
4275}
4376
You can’t perform that action at this time.
0 commit comments