Guest User

Untitled

a guest
Apr 25th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. macro_rules! create {
  2. ($struct_name:ident, $(($field:ident : $ty:ty)),*) => {
  3. #[derive(Debug, Default)]
  4. struct $struct_name {
  5. $(pub $field: $ty),*
  6. }
  7. }
  8. }
  9. fn main() {
  10. create!(Test, (a: i32), (b: String));
  11. let test = Test::default();
  12. println!("{:#?}", test);
  13. }
Add Comment
Please, Sign In to add comment