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 for this crate, to be glob-imported in relevant code.
Structs
- Iterator returned by
StackingIteratorExt::collecting
.
Enums
- Control flow involving a stack.
- Stack operation.
Traits
- Opposite of
Extend
. - Extra methods for iterators of
Instruction
s.