2023-04-20 10:19:36 -05:00
|
|
|
//@aux-build:macro_rules.rs
|
|
|
|
|
2020-03-04 06:59:10 -06:00
|
|
|
extern crate macro_rules;
|
|
|
|
|
|
|
|
// STMT
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! pub_macro {
|
|
|
|
() => {
|
|
|
|
let _ = "hello Mr. Vonnegut";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
pub mod inner {
|
|
|
|
pub use super::*;
|
|
|
|
|
|
|
|
// RE-EXPORT
|
|
|
|
// this will stick in `inner` module
|
2023-03-07 08:40:55 -06:00
|
|
|
pub use macro_rules::mut_mut;
|
2020-03-04 06:59:10 -06:00
|
|
|
pub use macro_rules::try_err;
|
|
|
|
|
2020-05-15 07:36:56 -05:00
|
|
|
pub mod nested {
|
|
|
|
pub use macro_rules::string_add;
|
|
|
|
}
|
|
|
|
|
2020-03-04 06:59:10 -06:00
|
|
|
// ITEM
|
|
|
|
#[macro_export]
|
2020-03-13 17:54:32 -05:00
|
|
|
macro_rules! inner_mod_macro {
|
2020-03-04 06:59:10 -06:00
|
|
|
() => {
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub struct Tardis;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// EXPR
|
|
|
|
#[macro_export]
|
2020-03-13 17:54:32 -05:00
|
|
|
macro_rules! function_macro {
|
2020-03-04 06:59:10 -06:00
|
|
|
() => {
|
|
|
|
if true {
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// TYPE
|
|
|
|
#[macro_export]
|
2020-03-13 17:54:32 -05:00
|
|
|
macro_rules! ty_macro {
|
2020-03-04 06:59:10 -06:00
|
|
|
() => {
|
|
|
|
Vec<u8>
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
mod extern_exports {
|
|
|
|
pub(super) mod private_inner {
|
|
|
|
#[macro_export]
|
2020-03-13 17:54:32 -05:00
|
|
|
macro_rules! pub_in_private_macro {
|
2020-03-04 06:59:10 -06:00
|
|
|
($name:ident) => {
|
|
|
|
let $name = String::from("secrets and lies");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|