summaryrefslogtreecommitdiffstats
path: root/third_party/rust/error-chain/examples/all.rs
blob: 840ca95e27b2af3d5850841fc3a6196fe1768f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[macro_use]
extern crate error_chain;

pub mod inner {
    error_chain! {}
}

#[cfg(feature = "a_feature")]
pub mod feature {
    error_chain! {}
}

error_chain! {
    // Types generated by the macro. If empty or absent, it defaults to
    //     Error, ErrorKind, Result;
    types {
        // With custom names:
        MyError, MyErrorKind, MyResult;
        // Without the `Result` wrapper:
        //     Error, ErrorKind;
    }

    // Automatic bindings to other error types generated by `error_chain!`.
    links {
        Inner(inner::Error, inner::ErrorKind);
        // Attributes can be added at the end of the declaration.
        Feature(feature::Error, feature::ErrorKind) #[cfg(feature = "a_feature")];
    }

    // Bindings to types implementing std::error::Error.
    foreign_links {
        Io(::std::io::Error);
    }
}

fn main() {}