Skip to content

ottermata/iter-opt-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iter-opt-filter   Latest Version Docs

This crate adds an optional filter to iterators. The problem this attempts to solve is the combination of multiple filters that can be enabled/disabled at runtime.

Example

use iter_opt_filter::IteratorOptionalFilterExt;

let mut iter = (0..3)
    .optional_filter(Some(|&item: &usize| item % 2 == 0))
    .optional_filter(None::<fn(&usize) -> bool>)
    .optional_filter(Some(|&item: &usize| item > 1));

assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), None);

About

Optional filtering for Rust Iterators

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages