我正在尝试使用 Rayon 的par_iter而不是并行化 Ramer\xe2\x80\x93Douglas-Peucker 线简化算法iter:
extern crate num_traits;\nuse num_traits::{Float, ToPrimitive};\nextern crate rayon;\nuse self::rayon::prelude::*;\n\n#[derive(PartialEq, Clone, Copy, Debug)]\npub struct Coordinate<T>\n where T: Float\n{\n pub x: T,\n pub y: T,\n}\n\n#[derive(PartialEq, Clone, Copy, Debug)]\npub struct Point<T>(pub Coordinate<T>) where T: Float;\n\nimpl<T> Point<T>\n where T: Float + ToPrimitive\n{\n pub fn new(x: T, y: T) -> Point<T> {\n Point(Coordinate { x: x, y: y })\n }\n pub fn x(&self) -> T {\n self.0.x\n }\n pub fn y(&self) -> T {\n self.0.y\n }\n}\n\nunsafe …Run Code Online (Sandbox Code Playgroud)