I ended up tying the state to the struct im implementing my app on.
I am making a cacher.
I built local caches for my apps like a billion times in golang before.
What I used to do was to create a global-local variable and have exported methods
which are internally locking and unlocking the data for a thread-safe store.
In rust, however, I cannot have a similar approach
since I cannot declare any global variables.
I tried to use const boxed map to no avail either.
What are you strategies for building this sort of libs in your app
without separating the entire logic as a service(which is the first thing came to my mind)
or having user to pass a state reference on every call?
What is the way for a module to be able to have an internal state?
here is a small example to demonstrate what im trying to do and what i get as a result