This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Description
The fact that a plugin has to be Default makes it very unergonomic, especially if the plugin state contains many types that aren't Default, which are initialized in new() (such as Sender/Receiver), requiring wrapping them in Option etc.
Plugin::new only requires Default because PluginInstance impls Plugin but doesn't impl the Plugin::new method (PluginInstance is not Default)!
PluginInstance has an inherent new method with a different signature: fn new(effect: *mut AEffect, lib: Arc<Library>) -> PluginInstance.
The options we have is to either impl Plugin::new for PluginInstance (it is never called anyway, (because Plugin::new is only called on the client side, but PluginInstance is only used on the host side), so we could just use unreachable!()) or moving the new method from Plugin into a new trait PluginWithNew: Plugin { fn new(host: HostCallback) -> Self; }.