3 ms·
You can implement a linked list in safe Rust (even a doubly linked list if your prefer), there are a number of examples available if you google for it - for ins
by ameixaseca 5y ago
You can implement a linked list in safe Rust (even a doubly linked list if your prefer), there are a number of examples available if you google for it - for instance:
https://gist.github.com/matey-jack/3e19b6370c6f7036a9119b79a82098ca https://gist.github.com/matey-jack/3e19b6370c6f7036a9119b79a...
In fact, the Rust book explicitly mentions doubly linked lists when discussing Pin:
https://doc.rust-lang.org/std/pin/index.html#example-intrusive-doubly-linked-list https://doc.rust-lang.org/std/pin/index.html#example-intrusi...
The ownership system might make it less trivial to implement, but the statement that you cannot implement it in safe Rust is incorrect regardless.