Created
February 21, 2018 23:39
-
-
Save anonymous/dad7acf949f0de540e9f8aca5feefe61 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(trace_macros)] trace_macros!(true); | |
macro_rules! doc_items { | |
(@distribute $docs:tt $($item:item)*) => { | |
$(doc_items!(@output $docs $item);)* | |
}; | |
(@output [$($doc:expr),*] $item:item) => { | |
$(#[doc=$doc])* | |
$item | |
}; | |
{ | |
$( | |
$(#[doc = $doc:expr])* | |
{ | |
$( | |
$item:item | |
)* | |
} | |
)+ | |
} => { | |
$(doc_items!(@distribute [$($doc),*] $($item)*);)* | |
}; | |
} | |
doc_items! { | |
/// A | |
{ | |
struct Foo; | |
struct Bar; | |
} | |
/// B | |
{ | |
struct Baz; | |
struct Quux; | |
} | |
} | |
fn main() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment