1- use std;
1+ use std:: { self , fmt, error} ;
2+
3+
4+ #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
5+ /// Copy of [TryFromIntError](https://doc.rust-lang.org/std/num/struct.TryFromIntError.html)
6+ /// that works in stable rust
7+ pub struct TryFromIntError { }
8+
9+ impl TryFromIntError {
10+ fn description ( & self ) -> & str {
11+ "out of range integral type conversion attempted"
12+ }
13+ }
14+
15+ impl fmt:: Display for TryFromIntError {
16+ fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
17+ self . description ( ) . fmt ( fmt)
18+ }
19+ }
20+
21+ impl error:: Error for TryFromIntError {
22+ fn description ( & self ) -> & str {
23+ self . description ( )
24+ }
25+ }
26+
27+ #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
28+ /// Copy of [CharTryFromError](https://doc.rust-lang.org/std/char/struct.CharTryFromError.html)
29+ /// that works in stable rust
30+ pub struct CharTryFromError { }
31+
32+ impl CharTryFromError {
33+ fn description ( & self ) -> & str {
34+ "converted integer out of range for `char`"
35+ }
36+ }
37+
38+ impl fmt:: Display for CharTryFromError {
39+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
40+ self . description ( ) . fmt ( f)
41+ }
42+ }
43+
44+ impl error:: Error for CharTryFromError {
45+ fn description ( & self ) -> & str {
46+ self . description ( )
47+ }
48+ }
249
350error_chain ! {
451 types {
@@ -8,8 +55,8 @@ error_chain! {
855 foreign_links {
956 Io ( std:: io:: Error ) ;
1057 FromUtf8 ( std:: string:: FromUtf8Error ) ;
11- TryFromIntError ( std :: num :: TryFromIntError ) ;
12- CharTryFromError ( std :: char :: CharTryFromError ) ;
58+ TryFromIntError ( TryFromIntError ) ;
59+ CharTryFromError ( CharTryFromError ) ;
1360
1461 UuidParseError ( :: uuid:: ParseError ) #[ cfg( feature = "uuid" ) ] ;
1562 }
0 commit comments