diff --git a/src/rtree/trait.rs b/src/rtree/trait.rs index d621c69..aeaa3d2 100644 --- a/src/rtree/trait.rs +++ b/src/rtree/trait.rs @@ -151,7 +151,7 @@ pub trait RTreeIndex: Sized { y: N, max_results: Option, max_distance: Option, - ) -> Vec { + ) -> impl Iterator { let boxes = self.boxes(); let indices = self.indices(); let max_distance = max_distance.unwrap_or(N::max_value()); @@ -212,7 +212,7 @@ pub trait RTreeIndex: Sized { } } - results + results.into_iter() } /// Search items in order of distance from the given coordinate. @@ -221,7 +221,7 @@ pub trait RTreeIndex: Sized { coord: &impl CoordTrait, max_results: Option, max_distance: Option, - ) -> Vec { + ) -> impl Iterator { self.neighbors(coord.x(), coord.y(), max_results, max_distance) }