Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- macro_rules! create {
- ($struct_name:ident, $(($field:ident : $ty:ty)),*) => {
- #[derive(Debug, Default)]
- struct $struct_name {
- $(pub $field: $ty),*
- }
- }
- }
- fn main() {
- create!(Test, (a: i32), (b: String));
- let test = Test::default();
- println!("{:#?}", test);
- }
Add Comment
Please, Sign In to add comment