Persistent Data Structure Support

Overall thanks to everyone for the inputs. I marked the code as a solution which was what I was trying to get to- local mutability efficiency that rust supports with safe rules instead of persistent data structures and following FP principles in general as stated in this idiomatic rust question. Cheers!