Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
Add example with all the possible syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yamakaky committed Nov 20, 2016
1 parent 2374ed1 commit a78ea75
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions examples/all.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,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 of absent, it defaults to
// Error, ErrorKind, Result;
types {
// With custom names:
MyError, MyErrorKind, MyResult;
// Without the `Result` wrapper:
// Error, ErrorKind;
}

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

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

fn main() {}

0 comments on commit a78ea75

Please sign in to comment.