Rust | Iteration
Code\n\nimpl Solution {\n    pub fn diagonal_sum(mat: Vec<Vec<i32>>) -> i32 {\n        mat.iter().enumerate().fold(0, |sum, (i, v)| {\n            sum + v\n    
# Code\n```\nimpl Solution {\n    pub fn diagonal_sum(mat: Vec<Vec<i32>>) -> i32 {\n        mat.iter().enumerate().fold(0, |sum, (i, v)| {\n            sum + v\n                .iter()\n                .enumerate()\n                .filter(|(j, _)| &i == j || i + j == mat.len() - 1)\n                .map(|(_, x)| *x)\n                .sum::<i32>()\n        })\n    }\n}\n```
['Rust']