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

> Even a doubly-linked list is impossible to get through the borrow checker.

https://github.com/rust-lang/rust/blob/master/library/alloc/...

It's part of standard lib. And you don't get more idiomatic than that.



That looks like an allocating container. Probably the most useful property of linked lists and other node based data structures is the ability to make them intrusive and to avoid dynamic allocation. In some domains you just don't have a runtime allocator available to you, so this library would be useless.


> That looks like an allocating container

Depends what you mean by that. It has 2 pointer to other nodes and element on the heap (EDIT: Not stack). It's bog standard double linked list.

If you're looking for intrusive lists those a very niche data structure.

https://docs.rs/intrusive-collections/latest/intrusive_colle...


Yes, and the pointer management is all done using unsafe blocks:

https://github.com/rust-lang/rust/blob/master/library/alloc/...




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

Search: