File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change 1+ #![ cfg( feature = "h1_client" ) ]
2+
3+ use http_client:: { h1:: H1Client , HttpClient } ;
4+ use http_types:: { Method , Request } ;
5+
6+ #[ async_std:: main]
7+ async fn main ( ) {
8+ let client = H1Client :: new ( ) ;
9+
10+ let req = Request :: new ( Method :: Get , "http://example.org" ) ;
11+
12+ client. send ( req) . await . unwrap ( ) ;
13+
14+ dbg ! ( client) ;
15+ }
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