For some context, I have worked with Java, Node. My experience is mostly web-backend. Something we usually use in those kind of projects is a single db connection and inject/refer to the connection and build abstractions from that.
I'm looking to do the same thing, although not a web server. I tried searching for singleton in rust but there are multiple solutions. some are with libraries and some with unsafe etc...How can this be achieved in Rust or am I trying to force rust into something it's not. I really don't want/like everything to be passed on through function calls. Makes it harder to refactor if needed.
Aucun commentaire:
Enregistrer un commentaire