| author | |
| committer | |
| log | 6568f0f75b900d2ee27363b2ba81bedf206a13e7 |
| tree | 775a65f7dc164bc1d3cae51488504698ccf8735a |
| parent | b409cdf63f3496032bda83a88f54a7684feab92b |
| parent | 63a45b8ecdc9e4babd883be71dde1826f32b556f |
| signature |
Document that `remove` of Singly/DoublyLinkedList relies on the node being in the list2 files changed, 3 insertions(+), 0 deletions(-)
lib/std/DoublyLinkedList.zig+1| ... | @@ -105,6 +105,7 @@ pub fn prepend(list: *DoublyLinkedList, new_node: *Node) void { | ... | @@ -105,6 +105,7 @@ pub fn prepend(list: *DoublyLinkedList, new_node: *Node) void { |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | /// Remove a node from the list. | 107 | /// Remove a node from the list. |
| 108 | /// Assumes the node is in the list. | ||
| 108 | /// | 109 | /// |
| 109 | /// Arguments: | 110 | /// Arguments: |
| 110 | /// node: Pointer to the node to be removed. | 111 | /// node: Pointer to the node to be removed. |
lib/std/SinglyLinkedList.zig+2| ... | @@ -85,6 +85,8 @@ pub fn prepend(list: *SinglyLinkedList, new_node: *Node) void { | ... | @@ -85,6 +85,8 @@ pub fn prepend(list: *SinglyLinkedList, new_node: *Node) void { |
| 85 | list.first = new_node; | 85 | list.first = new_node; |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /// Remove `node` from the list. | ||
| 89 | /// Asserts that `node` is in the list. | ||
| 88 | pub fn remove(list: *SinglyLinkedList, node: *Node) void { | 90 | pub fn remove(list: *SinglyLinkedList, node: *Node) void { |
| 89 | if (list.first == node) { | 91 | if (list.first == node) { |
| 90 | list.first = node.next; | 92 | list.first = node.next; |