Module im::list [] [src]

Cons List

An implementation of immutable proper cons lists.

Structure can be shared between lists (and is reference counted), and append to the front of a list is O(1). Cons cells keep track of the length of the list at the current position, as an extra optimisation, so getting the length of a list is also O(1). Otherwise, operations are generally O(n).

Items in the list generally need to implement Clone, because the shared structure makes it impossible to determine the lifetime of a reference inside the list. When cloning values would be too expensive, use List<Rc<T>> or List<Arc<T>>.

Structs

ListIter

Enums

List

A list of elements of type A.

Functions

cons

Prepend a value to a list.