Create A New Copy Of An Object From A Reference In Rust
This took me some time (and a call for help) to figure out.
I've got a config I want to pass as a reference to lower functions. One of those needs to change a value.
Doing this straight-forward let mut config2 = config.clone();
does what I need.
Output:
[_active_nvim_run:25:3] &config.item = "bravo"
[_active_nvim_run:14:3] &config.item = "alfa"
-- end of line --
Endnotes
The first time I tried this I was doing `*config.clone()` which doesn't work. It gives an error: error[E0614]: type 'Config' cannot be dereferenced