-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I'm researching best approach for writing business app code like typically done in JVM languages etc. I'm not a fan of OOP, and I really dislike SpringBoot style automagic DI. However abstracting away external components behind an interface, and constructor-passing DI are really great for larger apps.
In the past when doing trait as an interface for multiple implementations for DI, I would go for type SharedConnection = Arc<dyn Connection + Send + Sync + 'static>)
kind of thing, and I'm happy to finally find a crate that can get rid of some of that boilerplate.
However not long ago, I've read https://jmmv.dev/2022/04/rust-traits-and-dependency-injection.html#good-solution-newtype, and I think a NewType is even better, it's just I never wanted to put an effort writting out all that stuff.
Would supporting this pattern fall under the goals of this crate?
Going even further, I wonder if supporting things like struct Newtype(Arc<RwLock<dyn Trait + Send + Sync + 'static>>)
would be possible.