From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- third_party/rust/error-chain/examples/all.rs | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 third_party/rust/error-chain/examples/all.rs (limited to 'third_party/rust/error-chain/examples/all.rs') 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() {} -- cgit v1.2.3