RustAudio / vst3-sys

Raw Bindings to the VST3 API
Other
284 stars 18 forks source link

Fix VST3 attribute macro expension for structs with generics, comments, and attributes #42

Closed robbert-vdh closed 2 years ago

robbert-vdh commented 2 years ago

I was working on a small plugin framework, and I noticed that the macro expansion would fail in mysterious ways when the struct the #[VST3] attribute is applied on has generics. Putting comments inside of the struct or attaching attributes to the fields would also result in similar compiler errors because the generated allocate function would be malformed (with comments inside of the parameter list). This fixes the macro expansion for structs like these:

#[VST3(implements(IPluginFactory))]
pub struct Factory<P: Plugin> {
    /// The type will be used for constructing plugin instances later.
    _phantom: PhantomData<P>,
}
m-hilgendorf commented 2 years ago

Thank you, @robbert-vdh!