You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structService{}implService{pubfnprintln();}structBean{service:Option<RefCell<Service>>// this field is dependency injection}implBean{pubfndoSomeThing(&mutself){// call the dependency injection serviceself.service.println()....}}let service=Service{}let bean=Bean{}
actix.inject(service)
actix.inject(bean)// when dependency injection finish, call bean.doSomeThing() will success.
The text was updated successfully, but these errors were encountered:
Would you please add some detail about the scenario where dependency injection can be beneficial? It would be great if you can list pros and cons.
use dependency injection Reduce coupling
Unified management struct, For example, I want to count all the http api that I use. just call actix.beans() get All struct, You can do some automated scanning task or job(Very useful for reducing manual coding effort, just like java spring swagger UI scan your http API,auto create Doc )
for cons, The downside is that the configuration has become complex
will add dependency injection future?
same like :
The text was updated successfully, but these errors were encountered: