main.rs1223 chars53 lines
This implementation creates a generic linked list data structure in Rust, allowing you to store any type of data in the list. The Node
struct represents a single node in the linked list, with a field for the data held in the node and a field for a pointer to the next node in the list. The LinkedList
struct represents the linked list data structure as a whole, holding a pointer to the head node of the list.
The implementation includes functions to push new nodes onto the front of the linked list, pop the first node off the front of the list, and check if the list is empty. In the example usage code, we create a new linked list, push some integers onto the list, and then pop them off one at a time and print them.
gistlibby LogSnag