1 stable release
1.0.0 | Jul 27, 2023 |
---|
#2929 in Rust patterns
21KB
418 lines
stacking-iterator
Iterator utilities for manipulating stacks.
For more information, see the crate docs.
License
Available via the Anti-Capitalist Software License for individuals, non-profit organisations, and worker-owned businesses.
lib.rs
:
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.