Crate stacking_iterator

Source
Expand description

Iterator utilities for manipulating stacks.

This library is intended as an alternative to “borrowing” iterators for cases where collections are formed using a series of stack operations.

For example, when enumerating the accepted sequences in a finite-state automation, entering a state takes the form of a push, whereas exiting a state takes the form of a pop. If you reach an ending state at any point, the stack of transition keys can be read out as an accepted sequence.

While “pushing” to sequences takes the form of the built-in Extend, “popping” from sequences is done via the Contract trait provided by this crate. If you offer an iterator over Instruction items, you can then take advantage of the crate’s functionality using the StackingIteratorExt extension trait.

Modules§

prelude
Prelude for this crate, to be glob-imported in relevant code.

Structs§

Collecting
Iterator returned by StackingIteratorExt::collecting.

Enums§

Instruction
Control flow involving a stack.
Operation
Stack operation.

Traits§

Contract
Opposite of Extend.
StackingIteratorExt
Extra methods for iterators of Instructions.