Function len [src]

Iterate over all nodes, returning the count. This operation is O(N). Consider tracking the length separately rather than computing it.

Prototype

pub fn len(list: DoublyLinkedList) usize

Parameters

list: DoublyLinkedList

Source

pub fn len(list: DoublyLinkedList) usize { var count: usize = 0; var it: ?*const Node = list.first; while (it) |n| : (it = n.next) count += 1; return count; }