I suggest a new function to the iterators like JavaScript:
Function in JS:
let data = [
{ number: 1, letter: a },
{ number: 2, letter: b },
];
const hasNumber2 = data.some((e) => e.number == 2);
console.log(hasNumber2); // true
Expected in Rust:
struct Data {
number: i64,
letter: char,
}
fn main() {
let data: Vec<Data> = vec![
Data { number: 1, letter: 'a' },
Data { number: 2, letter: 'b' }
];
let hasNumber2 = data.iter().some(|d| d.number == 2);
println!("{}", hasNumber2); // true
}
If accepted, I can work on it.