dyn Trait vs generics, which one for a plugin registry
I'm building a small plugin system where each plugin implements a Handler trait with an async fn handle. I keep going back and forth between Box<dyn Handler> in a Vec and making the registry generic over H: Handler. With generics I can't easily store different plugin types together. With dyn I get a lifetime and object-safety headache. What's the call here?
4 replies