mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
16 lines
252 B
Rust
16 lines
252 B
Rust
#![feature(decl_macro)]
|
|
|
|
macro x($macro_name:ident) {
|
|
#[macro_export]
|
|
macro_rules! $macro_name {
|
|
(define) => {
|
|
pub struct MyStruct;
|
|
};
|
|
(create) => {
|
|
MyStruct {}
|
|
};
|
|
}
|
|
}
|
|
|
|
x!(my_struct);
|