[][src]Module nimiq_collections::unique_linked_list

A doubly-linked list with owned nodes and a unique constraint enforced by a HashMap.

As with the HashMap type, a UniqueLinkedList requires that the elements implement the Eq and Hash traits. This can frequently be achieved by using #[derive(PartialEq, Eq, Hash)]. If you implement these yourself, it is important that the following property holds:

k1 == k2 -> hash(k1) == hash(k2)

In other words, if two keys are equal, their hashes must be equal.

It is a logic error for an item to be modified in such a way that the item's hash, as determined by the Hash trait, or its equality, as determined by the Eq trait, changes while it is in the set. This is normally only possible through Cell, RefCell, global state, I/O, or unsafe code.

The UniqueLinkedList allows pushing and popping elements at either end in amortized constant time.

Structs

IntoIter

An owning iterator over the elements of a UniqueLinkedList.

Iter

An iterator over the elements of a UniqueLinkedList.

UniqueLinkedList

A doubly-linked list with owned nodes and a unique constraint enforced by a HashMap.