Closed austinjones closed 3 years ago
I feel like the workaround of calling module.resolve_ref().clone()
would work just fine. Why should this be special-cased? Can you give more details on your requirements; perhaps there is a better way to solve your problem (e.g. database pool).
@austinjones Can you elaborate on your issue/proposal? Otherwise the issue will be closed.
It would be really useful if you could define components that would be injected as Self, and cloned instead of shared with Arc. Many types in Rust internally maintain shared state behind an Arc, and can be cloned as cheaply as the Arc wrapper that Shaku provides.
A good example is
mongodb::Client
(more details in #20).Here is an example with an invented client struct: