File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
//! Possible SLIP encoding and decoding errors
2
2
3
+ use core:: fmt;
4
+
3
5
/// Type alias for handling SLIP errors.
4
6
pub type Result < T > = core:: result:: Result < T , self :: Error > ;
5
7
@@ -18,3 +20,14 @@ pub enum Error {
18
20
/// The decoder cannot process the SLIP escape sequence.
19
21
BadEscapeSequenceDecode ,
20
22
}
23
+
24
+ impl fmt:: Display for Error {
25
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
26
+ f. write_str ( match self {
27
+ Error :: NoOutputSpaceForHeader => "insufficient space in output buffer for header" ,
28
+ Error :: NoOutputSpaceForEndByte => "insufficient space in output buffer for end byte" ,
29
+ Error :: BadHeaderDecode => "malformed header" ,
30
+ Error :: BadEscapeSequenceDecode => "malformed escape sequence" ,
31
+ } )
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments