Expand description

The Iterator design pattern example module

A custom container is instantiated (it already contains hard-coded data to iterate over). The custom container can then deliver three iterators, each providing a different aspect of the hard-coded data.

Accessed through the iterator_exercise() function.

Modules

  • Definition of the IIterator trait that is implemented by the various iterators shown in the “Iterator” design pattern example.
  • Implementation of the Items container, and the KeyIterator, ValueIterator, and ItemIterator structs that each implement the IIterator trait.

Functions