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

Don't require Plugin to impl Default #153

@Boscop

Description

@Boscop

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; }.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions