I want to have a tree of objects that implement a specific trait and I want this tree to live in another thread and be able to update parameters of these objects. I will be writing a library and would like users of the library (which will include me via other crates) to be able to create their own object types, which also implement that specific trait, and send them into this thread to get put into that tree and also be able to have parameters updated. My initial set of objects might include an audio oscillator that accepts a command to update its frequency with a f32 but maybe in the future someone wants to update their own object with something like i32 or f64 or some enumeration or struct type.
I’m wondering if, with the current state of safe rust, ideally stable but at-least sooner than later to be made stable [I’m thinking this excludes specialization], there is a way to implement a command or visitor pattern that allows me to, down the line, add new command types with new types of parameters after the initial command or visitor interface is defined?
With specialization it looks like you can do it just fine, but specialization still feels a ways off from stability, and I should test to see if this works across crates: