Function append [src]

Insert a new node at the end of the list. Arguments: new_node: Pointer to the new node to insert.

Prototype

pub fn append(list: *DoublyLinkedList, new_node: *Node) void

Parameters

list: *DoublyLinkedListnew_node: *Node

Source

pub fn append(list: *DoublyLinkedList, new_node: *Node) void { if (list.last) |last| { // Insert after last. list.insertAfter(last, new_node); } else { // Empty list. list.prepend(new_node); } }