cannot borrow data in a dereference of `PATHS` as mutable
trait `DerefMut` is required to modify through a dereference, but it is not implemented for `PATHS`
Globals in Rust can't be safely mutably borrowed. You either have to redesign your application to avoid global state, or use some type allowing internal mutation (example: Mutex). I recommand you go with the first approach : avoid global state.
Yes, so you see that PATHS is not declared as mut and cannot be borrowed as mut.
If you want mutability, you have to wrap it in a type that gives you interior mutability. For example a Mutex.
The typical strategy is to pass the shared state to each function as an argument. You can also store the thing in a struct so it is available as self.whatever.
If it starts feeling cumbersome to pass all these shared objects around via arguments I normally interpret that as my code saying "maybe you are sharing too much state here and should refactor your code to be less coupled?"