File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use async_h1::{
55use async_std:: io:: { Read , Write } ;
66use http_types:: { Request , Response , Result } ;
77use std:: {
8- fmt:: Debug ,
8+ fmt:: { Debug , Display } ,
99 future:: Future ,
1010 io,
1111 pin:: Pin ,
@@ -122,17 +122,19 @@ impl CloseableCursor {
122122 self . len ( ) == self . cursor ( )
123123 }
124124
125- pub fn to_string ( & self ) -> String {
126- std:: str:: from_utf8 ( & * self . data . read ( ) . unwrap ( ) )
127- . unwrap_or ( "not utf8" )
128- . to_owned ( )
129- }
130-
131125 fn close ( & self ) {
132126 * self . closed . write ( ) . unwrap ( ) = true ;
133127 }
134128}
135129
130+ impl Display for CloseableCursor {
131+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
132+ let data = & * self . data . read ( ) . unwrap ( ) ;
133+ let s = std:: str:: from_utf8 ( data) . unwrap_or ( "not utf8" ) ;
134+ write ! ( f, "{}" , s)
135+ }
136+ }
137+
136138impl TestIO {
137139 pub fn new ( ) -> ( TestIO , TestIO ) {
138140 let client = Arc :: new ( CloseableCursor :: default ( ) ) ;
You can’t perform that action at this time.
0 commit comments