Rust example: iterator adapters
Transform and reduce a vector using Rust iterator adapters.
Shows Rust's lazy iterator adapters chained into a pipeline. Starting from a Vec<i32>, .iter() yields references, .filter() keeps only even numbers, .map() squares each one, and .sum() reduces them to a single total. A second chain uses .map() plus .collect() to build a new doubled vector, demonstrating how iterators replace manual loops.