Add an AsyncExecutor associated type to Plugin

This will make it possible to run background tasks in a type safe way.
Sadly, this does mean that every plugin now needs to define the type
alias and constructor function since Rust does not yet support defaults
for associated types.
This commit is contained in:
Robbert van der Helm
2022-10-21 23:52:46 +02:00
parent 25d20f1950
commit 297ad2a83e
17 changed files with 74 additions and 0 deletions

View File

@@ -123,6 +123,9 @@ impl Plugin for LoudnessWarWinner {
const DEFAULT_INPUT_CHANNELS: u32 = 2;
const DEFAULT_OUTPUT_CHANNELS: u32 = 2;
type AsyncExecutor = ();
fn async_executor(&self) -> Self::AsyncExecutor {}
fn params(&self) -> Arc<dyn Params> {
self.params.clone()
}