[Rust] | Idiomatic Solution
\nEdit, shorter version:\n\nimpl Solution {\n    pub fn find_poisoned_duration(time_series: Vec<i32>, duration: i32) -> i32 {\n        time_series\n\t\t\t.windo
\nEdit, shorter version:\n```\nimpl Solution {\n    pub fn find_poisoned_duration(time_series: Vec<i32>, duration: i32) -> i32 {\n        time_series\n\t\t\t.windows(2)\n\t\t\t.fold(duration, |acc, pair| acc + i32::min(duration, pair[1] - pair[0]))\n    }\n}\n```\n\nOld version:\n```\nuse std::cmp;\n\nimpl Solution {\n    pub fn find_poisoned_duration(time_series: Vec<i32>, duration: i32) -> i32 {\n        time_series\n\t\t\t.windows(2)\n\t\t\t.fold(duration, |acc, pair| if let [prev, curr] = pair {\n                acc + cmp::min(duration, curr - prev)\n            } else {\n                acc\n            })\n    }\n}\n```
['Rust']