Strong references in a doubly linked list (Rc::try_unwrap)

Hi guys, I'm trying to implement a doubly linked list, but once every node could be referenced by its neighbors the number of strong references pointing to it could be greater than 1, which led to an error when I call Rc::try_unwrap(head). Is there a way to bypass that check or avoid having strong references without losing safety?

You can have weak references instead. You're probably looking for Weak

You should destroy all the references to it first. That will allow you to unwrap it.

Btw, please do not post images. We have code blocks for a reason:

// your code here

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.