(Ab)using the type system
I'm making a modular renderer, which is build up of multiple rendering passes. Each pass has 3 associated traits: Init, implemented for a struct that provides the default values for the pass, RenderHandle: implemented for the struct the non-render thread(s) interact with and RenderPass, which is on the render thread.
Init also has a function Storage, which returns what RenderPass needs to receive as storage, and these structs then need to be made using a function.
My question is: Is there a way to make something like this?
My general need is to go from Type -> Box<dyn trait>, or Init::Type -> Box<dyn trait>