Hi all - I am learning Rust and working on my first non-trivial program. I have a recursive descent parser, and one of the outputs is a set of strings which I’m using a HashSet for.
I’d like to keep everything immutable and have each recursive call take in a state struct containing a hash set, and return a new state struct.
Does Rust have the concept of taking an immutable collection, and returning a new immutable collection with an element added? Something like
// other fields
Or is practice just to make the set mutable?