Here's some tests to see it in action.
#[test]
fn test_find_many() {
let mut v = vec![(0, 1), (0, 2), (0, 3), (0, 4), (0, 5)];
let keys = [&2, &3];
let res = find_many(&mut v, keys, |item, key| &item.1 == key);
let unwrapped = res.unwrap();
assert_eq!(*unwrapped[0], (0, 2));
assert_eq!(*unwrapped[1], (0, 3));
}
#[test]
fn test_duplicate_key() {
let mut v = vec![(0, 1), (0, 2), (0, 3), (0, 4), (0, 5)];
let keys = [&2, &2];
let res = find_many(&mut v, keys, |item, key| &item.1 == key);
assert!(res.is_none());
}
#[test]
fn test_missing_key() {
let mut v = vec![(0, 1), (0, 2), (0, 3), (0, 4), (0, 5)];
let keys = [&2, &7];
let res = find_many(&mut v, keys, |item, key| &item.1 == key);
assert!(res.is_none());
}