Debian Codegraph @

third_party/rust/error-chain/examples/all.rs

raw
1 #[macro_use]
2 extern crate error_chain;
3
4 pub mod inner {
5 error_chain! {}
6 }
7
8 #[cfg(feature = "a_feature")]
9 pub mod feature {
10 error_chain! {}
11 }
12
13 error_chain! {
14 // Types generated by the macro. If empty or absent, it defaults to
15 // Error, ErrorKind, Result;
16 types {
17 // With custom names:
18 MyError, MyErrorKind, MyResult;
19 // Without the `Result` wrapper:
20 // Error, ErrorKind;
21 }
22
23 // Automatic bindings to other error types generated by `error_chain!`.
24 links {
25 Inner(inner::Error, inner::ErrorKind);
26 // Attributes can be added at the end of the declaration.
27 Feature(feature::Error, feature::ErrorKind) #[cfg(feature = "a_feature")];
28 }
29
30 // Bindings to types implementing std::error::Error.
31 foreign_links {
32 Io(::std::io::Error);
33 }
34 }
35
36 fn main() {}