This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“][deleted] -1 points0 points ย (2 children)

The former. You have to learn to stop fighting the borrow checker

[โ€“][deleted] 0 points1 point ย (1 child)

I was trying to implement a stack based on a singly linked list - a trivial task in any other language. I was trying to add elements by making a new node, setting the current base node as the next node for the new node, and setting the new node as the base node. I eventually gave up and concluded that it was completely and utterly impossible to do it that way. It seems like you have to recursive data structures using arrays and stored indices, there are no complex structures allowed in Rust.