diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /third_party/rust/error-chain/examples/all.rs | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/error-chain/examples/all.rs')
-rw-r--r-- | third_party/rust/error-chain/examples/all.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/third_party/rust/error-chain/examples/all.rs b/third_party/rust/error-chain/examples/all.rs new file mode 100644 index 0000000000..840ca95e27 --- /dev/null +++ b/third_party/rust/error-chain/examples/all.rs @@ -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 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() {} |