box-o-sand/rustbyexample/fn.d/closures.d/capture2.rs
2023-10-01 06:01:54 -04:00

9 lines
178 B
Rust

fn main() {
let haystack = vec![1, 2, 3];
let contains = move |needle| haystack.contains(needle);
println!("{}", contains(&1));
println!("{}", contains(&4));
}