// borrowing avoids handing over (or copying) the whole Vec
fn sum(v: &[u64]) -> u64 {
v.iter().sum()
}
fn main() {
let data: Vec<u64> = (1..=1000).collect();
let s = sum(&data);
// data is untouched and still owned
println!("{s}, kept {} items", data.len());
}pass &[T] to avoid moves and copies