Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>I don't mind the callout that you need to use unsafe for recursive structures

You don't, really. Recursion is not the important part. The ownership model is hierarchical. If your structure is a directed tree with all links (pointers) flowing out from the root, it can easily be built. As soon have you have cycles or multiple parents, you'll need either unsafe or some ownership extension like shared ownership (Rc/Arc).

Singly linked list => Easy

Tree => Easy

Tree with backreferences => probably best to use unsafe

Graph => probably needs unsafe for best performance



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: