Why writing a linked list in safe Rust is so damned hard
That Rusts compiler fights against intuitive doubly linked lists is reasonable, because they wouldn&#x27;t work when working in parallel on the list, while Rust by default also ensures safety doing that.<p>Having that in mind makes it easier for me to come up with ways how to appease the compiler. What measures would you take to write a thread-safe doubly linked list in C? Would you make it entirely exclusive and blocking? Well, then you might want let one &quot;list&quot; structure own all nodes. Would you want to allow parallel execution of operations on the list? Well, then break the ownership of the nodes up into smaller parts that you can hand out in parallel when they don&#x27;t affect each other. What granularity of allowed and prepared-for parallelism gives the best performance depends on the use-case.