To be honest, I wish sometimes Rust had an optional GC mode (I know this would be against the principles of the language… don’t take this wish too seriously).
If you just need the occasional cop-out, you can wrap a value in an Rc or an Arc. They do reference-counting, which is almost like garbage collection (reference counting can’t resolve cycles between references).
If you just need the occasional cop-out, you can wrap a value in an
Rc
or anArc
. They do reference-counting, which is almost like garbage collection (reference counting can’t resolve cycles between references).