I'm learning how to use Rocket, but I don't believe my question is specific to Rocket.
I want to define several routes that share access to a HashMap
.
You can see my code here: https://github.com/mvolkmann/rust-rocket-demo/blob/master/src/main.rs#L18
When I enter cargo clippy
I get lots of errors that say "can't capture dynamic environment in a fn item".
I understand why it says this. Functions are not closures, so my functions cannot see dog_map
.
But what is the best way to handle this? I could try changing all my functions that want to access dog_map
to be closures, but then maybe the Rocket attributes like get
and post
won't work.