2023-04-20 15:19:36 +00:00
|
|
|
//@aux-build:macro_rules.rs
|
|
|
|
|
2020-03-04 12:59:10 +00: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-07-03 17:42:48 +00:00
|
|
|
pub use macro_rules::{mut_mut, try_err};
|
2020-03-04 12:59:10 +00:00
|
|
|
|
2020-05-15 12:36:56 +00:00
|
|
|
pub mod nested {
|
|
|
|
pub use macro_rules::string_add;
|
|
|
|
}
|
|
|
|
|
2020-03-04 12:59:10 +00:00
|
|
|
// ITEM
|
|
|
|
#[macro_export]
|
2020-03-13 22:54:32 +00:00
|
|
|
macro_rules! inner_mod_macro {
|
2020-03-04 12:59:10 +00:00
|
|
|
() => {
|
|
|
|
#[allow(dead_code)]
|
|
|
|
pub struct Tardis;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// EXPR
|
|
|
|
#[macro_export]
|
2020-03-13 22:54:32 +00:00
|
|
|
macro_rules! function_macro {
|
2020-03-04 12:59:10 +00:00
|
|
|
() => {
|
|
|
|
if true {
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
// TYPE
|
|
|
|
#[macro_export]
|
2020-03-13 22:54:32 +00:00
|
|
|
macro_rules! ty_macro {
|
2020-03-04 12:59:10 +00:00
|
|
|
() => {
|
|
|
|
Vec<u8>
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
mod extern_exports {
|
|
|
|
pub(super) mod private_inner {
|
|
|
|
#[macro_export]
|
2020-03-13 22:54:32 +00:00
|
|
|
macro_rules! pub_in_private_macro {
|
2020-03-04 12:59:10 +00:00
|
|
|
($name:ident) => {
|
|
|
|
let $name = String::from("secrets and lies");
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|