selfref
is a fairly well documented crate for self-referential structs. it used to be a bit of a pain to use due to issues we had with closures when used with GATs/associated types, but we're working on fixing support for closures (with selfref
0.3 significantly improving the ability to use self-referential structs, with the caveat that constructing them is still a pain).
selfref
0.4 should bring similar improvements to construction, but we're unsure if it's sound. please take a look. blob
disclaimer: the crate (currently) relies on the !Unpin
hack, but we're working with a few folks on a more proper way of doing this in the future. please disregard the !Unpin
hack as a soundness issue.
cc @steffahn