Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(trace_macros)]
- trace_macros!(true);
- macro_rules! new_struct {
- ($name:ident, $($type:ty),*) => {
- struct $name {
- $(
- $type: $type
- ),*
- }
- }
- }
- struct FieldA;
- struct FieldB;
- new_struct!(Struct, FieldA, FieldB);
- /*
- Desired Output:
- struct Struct {
- field_a: FieldA,
- field_b: FieldB,
- }
- */
- fn main() {
- }
Add Comment
Please, Sign In to add comment