4 ms·
I wasn't thinking "use std::collections::LinkedList with an allocator parameter," just that like: 1. The reason linked lists in Rust are difficult is due to li
by steveklabnik 2y ago
I wasn't thinking "use std::collections::LinkedList with an allocator parameter," just that like:
1. The reason linked lists in Rust are difficult is due to lifetimes.
2. Arenas in Rust are parameterized by a lifetime, and that does the stuff you want here, that is, make sure that they can't go away until the arena does.
3. This means this should Just Work.
I haven't written the code because I don't think it would be that useful. I already wrote one terrible linked list based on generational indices that's not useful for anything, so doing it again doesn't sound that fun, haha. Looking at chainlink, it's roughly the same design, except with a Vec instead of the arena, which isn't much of a difference.
> Kind of embarrassed now.
No need to be embarrassed by asking good-faith questions.