ez_impl/
macro_rules.rs

1#[macro_export]
2macro_rules! throw {
3    ($msg:literal $(,)?) => { {
4        ::ez::__::Err(::ez::Error::msg($msg))?;
5        unreachable!()
6    } };
7
8    ($msg:literal $(, $rest:tt)* $(,)?) => { {
9        ::ez::__::Err(::ez::Error::msg(format!($msg $(, $rest)*)))?;
10        unreachable!()
11    } };
12
13    ($error:expr $(,)?) => { {
14        ::ez::__::Err($error)?;
15        unreachable!()
16    } };
17
18    ($(,)?) => { {
19        ::ez::__::Err(::ez::__::core::default::Default::default())?;
20        unreachable!()
21    } };
22}
23
24#[macro_export]
25macro_rules! publish {
26    {
27        pub use $path:path $(as $name:ident)?;
28        $(prose from $doc:literal;)*
29        $(example $example:ident;)*
30        $(failing example $failing:ident;)*
31    } => {
32        $(
33        ///
34        #[doc = include_str!(concat!("./", $doc))]
35        ///
36        )*
37        $(
38        ///
39        #[doc = concat!("## Example `", stringify!($example), "`")]
40        ///
41        /// ```rust
42        /// # use ez::__::*;
43        #[doc = include_str!(concat!("../examples/", stringify!($example), ".rs"))]
44        /// ```
45        )*
46        $(
47        ///
48        #[doc = concat!("## Example `", stringify!($failing), "`")]
49        ///
50        /// ```should_panic
51        /// # use ez::__::*;
52        #[doc = include_str!(concat!("../examples/", stringify!($failing), ".rs"))]
53        /// ```
54        )*
55        ///
56        #[doc(inline)]
57        pub use $path $(as $name)?;
58    }
59}