Amanieu/intrusive-rs

Singly-linked list with push_back?

g2p opened this issue · 2 comments

g2p commented

I would find it convenient (for implementing a custom LRU, with some fancy features but no way to remove arbitrary elements) to have a singly-linked list (with pointers going from the oldest LRU element to the newest), that also allows adding to the end of the list.
The APIs for getting CursorMut prevent this by forbidding keeping a mutable cursor to the end while accessing the list. Having a private CursorMut pointing to the end would allow providing a safe push_back API.

Would you be amenable to this idea? Should I send a pull request?

Sure! I would be happy to accept a pull request for this.

What do you have in mind for this? A separate SinglyLinkedListTail type?

g2p commented

I agree, a separate list type would work best.
I've given it more thought, and I need to customize more things for my LRU before I can extract a generally useful solution.