find_all 2.0.0

A (nearly) identical alternative for `Iterator::find` which returns an `Option<Vec<usize>>` containing all elements which meet a given predicate (instead of just the first)
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented2 out of 3 items with examples
  • Size
  • Source code size: 3.93 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • cook-f/find_all
    1 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nectariner

find_all

find_all is capable of finding all indexes of elements where a given predicate is met and therefore aims to be a simple alternative with (nearly) identical interface to the find method (this difference being returning an Option<Vec<usize>> instead of Option<usize>)

use find_all::FindAll;
let test_data = [1, 2, 3, 4, 1, 1, 1, 1];
let indexes = test_data.iter().find_all(|num: &&i32| **num == 9);
assert_eq!(indexes, None);

let indexes = test_data.iter().find_all(|num: &&i32| **num == 1);
assert_eq!(indexes, Some(vec![0,4,5,6,7]));

License: GPL-3.0-only