File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,8 @@ impl<T: AsyncRead + AsyncWrite> Buffered<T> {
72
72
match self . read_from_io ( ) {
73
73
Ok ( 0 ) => {
74
74
trace ! ( "parse eof" ) ;
75
- return Err ( io:: Error :: new ( io:: ErrorKind :: UnexpectedEof , "parse eof" ) . into ( ) ) ;
75
+ //TODO: With Rust 1.14, this can be Error::from(ErrorKind)
76
+ return Err ( io:: Error :: new ( io:: ErrorKind :: UnexpectedEof , ParseEof ) . into ( ) ) ;
76
77
}
77
78
Ok ( _) => { } ,
78
79
Err ( e) => match e. kind ( ) {
@@ -316,6 +317,21 @@ impl WriteBuf {
316
317
}
317
318
}
318
319
320
+ #[ derive( Debug ) ]
321
+ struct ParseEof ;
322
+
323
+ impl fmt:: Display for ParseEof {
324
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
325
+ f. write_str ( "parse eof" )
326
+ }
327
+ }
328
+
329
+ impl :: std:: error:: Error for ParseEof {
330
+ fn description ( & self ) -> & str {
331
+ "parse eof"
332
+ }
333
+ }
334
+
319
335
#[ cfg( test) ]
320
336
use std:: io:: Read ;
321
337
You can’t perform that action at this time.
0 commit comments