Of course in Rust you don't usually want a doubly-linked list. The
VecDeque array-based double-ended queue is usually much better. I discuss this in detail in my module's documentation.
Weirdly, there is a doubly linked list in the Rust standard library but it is good for literally nothing at all. Its API is so limited that you can always do better with a
VecDeque. There's a discussion (sorry, requires JS) about maybe deprecating it.
There's also another doubly-linked list available but despite being an 'intrusive' list (in C terminology) list it only supports one link per node, and insists on owning the items you put into it. I needed several links per node for my planar graph work, and I needed
Indeed given my analysis of when a doubly-linked list is needed, rather than a
VecDeque, I think it will nearly always involve something like
You can read the documentation online.It provides the facilities I needed, including lists where each node can be on multiple lists with runtime selection of the list link within each node. It's not threadsafe (so Rust will stop you using it across multiple threads) and would be hard to make threadsafe, I think.Notable wishlist items: entrypoints for splitting and joining lists, and good examples in the documentation. Both of these would be quite easy to add.
As I wrote earlier, because I am some kind of paranoid from the last century, I have hit cargo on the head so that it doesn't randomly download and run code from the internet.
This is done with stuff in my
~/.cargo/config. Of course this stops me actually accessing the real public repository (cargo automatically looks for
.cargo/config in all parent directories, not just in
$HOME). No problem - I was expecting to have to override it.
So I have had to override it in a silly way: I made a separate area on my laptop which belongs to me but which is not underneath my home directory. Whenever I want to run cargo publish, I copy the crate to be published to that other area, which is not a direct or indirect subdirectory of anything containing my usual