Hi,
I have the following macro:
macro_rules! create_struct {
(struct $name:ident {
$($field_name:ident: $field_type:ty,)*
}) => {
pub struct $name {
demo: String,
$($field_name: $field_type,)*
}
}
}
I can use it like this:
create_struct!(struct Test {});
It'd be really convenient to be able to add lifetimes or generic types in general to the struct created by the macro call.
Like this:
create_struct!(struct Test<'a> {});
How would I go about implementing such a functionality?
Thanks in advance !