项目作者: neithernut

项目描述 :
An Iterator suitable for navigating recursive structures and DAGs in rust
高级语言: Rust
项目地址: git://github.com/neithernut/transiter.git
创建时间: 2021-06-19T18:27:01Z
项目社区:https://github.com/neithernut/transiter

开源协议:MIT License

下载


TransIter — transitive iterator and utilities

This small rust crate provides TransIter, an iterator suitable for navigating
recursive structures and DAGs. The iterator allows for multiple modes of
iteration. For structures in which the nodes implement Ord, this crate also
provides a TransPrioQueue.

In addition to the iterators themselves, this crate provides some convenience
traits for creating instances of those iterators.

Example

  1. use transiter::IntoTransIter;
  2. let names: Vec<_> = String::new()
  3. .trans_iter_with(|s| { let s = s.clone(); ["a", "b", "c"].iter().map(move |c| s.clone() + c)})
  4. .take(10)
  5. .collect();
  6. assert_eq!(names, vec!["", "a", "b", "c", "aa", "ab", "ac", "ba", "bb", "bc"]);

Similar crates

The following crates serve a similar purpose:

  • reciter provides a macro for creating an
    iterator from a recursive function.

License

This work is provided under the MIT license. See LICENSE for more details.