📅  最后修改于: 2022-03-11 14:49:25.300000             🧑  作者: Mango
fn find_break(arr: &Vec) -> Option {
arr.windows(2).find(|arr| arr[1] != arr[0] + 1).map(|arr| arr[1])
}
fn main() {
println!("{}", match find_break(&vec![2, 3, 4, 5, 6, 7, 8]) {
Some(s) => s,
None => -1
});
}
// Rust Options Some None using closures