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::{
5
5
use async_std:: io:: { Read , Write } ;
6
6
use http_types:: { Request , Response , Result } ;
7
7
use std:: {
8
- fmt:: Debug ,
8
+ fmt:: { Debug , Display } ,
9
9
future:: Future ,
10
10
io,
11
11
pin:: Pin ,
@@ -122,17 +122,19 @@ impl CloseableCursor {
122
122
self . len ( ) == self . cursor ( )
123
123
}
124
124
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
-
131
125
fn close ( & self ) {
132
126
* self . closed . write ( ) . unwrap ( ) = true ;
133
127
}
134
128
}
135
129
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
+
136
138
impl TestIO {
137
139
pub fn new ( ) -> ( TestIO , TestIO ) {
138
140
let client = Arc :: new ( CloseableCursor :: default ( ) ) ;
You can’t perform that action at this time.
0 commit comments