@@ -2,44 +2,39 @@ use crate::std::string::String;
2
2
use crate :: std:: vec;
3
3
use crate :: std:: vec:: Vec ;
4
4
5
- #[ cfg( feature = "std" ) ]
6
5
use thiserror:: Error ;
7
6
8
7
use crate :: Bar ;
9
8
10
9
/// Errors that can occur during decoding.
11
- #[ derive( Debug , PartialEq ) ]
12
- #[ cfg_attr( feature = "std" , derive( Error ) ) ]
10
+ #[ derive( Debug , PartialEq , Error ) ]
13
11
pub enum DecodingError {
14
12
/// A sequence of modules resulted in an unknown pattern.
15
- #[ cfg_attr ( feature = "std" , error( "pattern {0:b} not recognized" ) ) ]
13
+ #[ error( "pattern {0:b} not recognized" ) ]
16
14
Pattern ( u16 ) ,
17
15
/// A bar's width or spacing is not valid.
18
- #[ cfg_attr ( feature = "std" , error( "bar is not valid" ) ) ]
16
+ #[ error( "bar is not valid" ) ]
19
17
InvalidBar ,
20
18
/// The stop code at the end is wrong.
21
- #[ cfg_attr ( feature = "std" , error( "wrong stop code" ) ) ]
19
+ #[ error( "wrong stop code" ) ]
22
20
WrongStop ,
23
21
/// The input was too short.
24
- #[ cfg_attr ( feature = "std" , error( "code too short to be valid" ) ) ]
22
+ #[ error( "code too short to be valid" ) ]
25
23
Short ,
26
24
/// The code's length can not fit an allowed sequence of modules.
27
- #[ cfg_attr ( feature = "std" , error( "length not correct" ) ) ]
25
+ #[ error( "length not correct" ) ]
28
26
Length ,
29
27
/// The checksum did not match.
30
- #[ cfg_attr ( feature = "std" , error( "checksum mismatch" ) ) ]
28
+ #[ error( "checksum mismatch" ) ]
31
29
Checksum ,
32
30
/// The code did not start with a mode signal.
33
- #[ cfg_attr ( feature = "std" , error( "start char did not signal mode" ) ) ]
31
+ #[ error( "start char did not signal mode" ) ]
34
32
NoMode ,
35
33
/// A symbol occurred in a mode that did not support it or is not implemented.
36
- #[ cfg_attr ( feature = "std" , error( "unexpected character {0:x}" ) ) ]
34
+ #[ error( "unexpected character {0:x}" ) ]
37
35
Unexpected ( u8 ) ,
38
36
/// After decoding the data the conversion from Latin 1 failed.
39
- #[ cfg_attr(
40
- feature = "std" ,
41
- error( "characters not covered by Latin 1 were part of this symbol" )
42
- ) ]
37
+ #[ error( "characters not covered by Latin 1 were part of this symbol" ) ]
43
38
Latin1 ,
44
39
}
45
40
0 commit comments