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