I\'m trying to implement a lazy-construction / memoized evaluation / caching idiom in Rust.
There\'s an outer type which has a bunch of data and an accessor method.
So, the primary motivation for me wanting to pass Thing
as an argument to ContainedThing::create
was to use Thing
's API to help in the construction. However, it turns out that I'll want it to be borrowed mutably, because I need recursive memoized construction here, and that makes it a cycle problem.
So, it looks like my separated check + insert logic is here to stay.