I'm interested in reproducing a "service registry" design pattern in Rust where by a key/value registry contains "services", each that implements a uniquely identifiable Trait. The intent here is to allow modules from anywhere in an application to look up and borrow a service to accomplish a task, without knowing the concrete implementation but rather only the Trait (contract) that is implemented.
One example of this in the wild is within the Pyramid Web framework (Python), which makes extensive use of the zope component architecture (and consequently zope interfaces).
How would you approach this design and would you consider this design pattern rustic?
It might be useful to know that Box<Trait> (Trait Object) is a special construct that uses traits via dynamic dispatch, so it's much more flexible than trying to use generics.
But I think another approach might be better, e.g. dependency injection. Or the registry, instead of supporting arbitrary key-value storage, having a fixed set of concrete getter functions for specific types.