I'm trying to factor out the interior mutability in my Rust code. It's a little more verbose, but surprisingly readable.
foo_old(&syntax);
foo_new(&syntax, &mut change_map);
Signatures are way more self-documenting with this approach.
miniblog.
Related Posts
You can go so far with simple data in Rust that it's kinda surprising when you start learning about interior mutability: https://doc.rust-lang.org/std/cell/index.html
If you give a function a value of &T, they can actually mutate any cells within it. It's not sufficient to look for &mut T usages.
Interior mutability in Rust: what, why, how? https://ricardomartins.cc/2016/06/08/interior-mutability (learning Cell and RefCell is a tricky new concept for new Rustaceans)