diff --git a/src/kdtree/mod.rs b/src/kdtree/mod.rs index 913a851..38ef9ff 100644 --- a/src/kdtree/mod.rs +++ b/src/kdtree/mod.rs @@ -90,7 +90,6 @@ impl<'a, F: Float, T> Iterator for NearestNeighboursIter<'a, F, T> pub struct KdTree { nodes: Vec>, - node_adding_dimension: usize, node_depth_during_last_rebuild: usize, current_node_depth: usize, @@ -299,17 +298,25 @@ impl> KdTree { } #[inline] - fn into_iter(self) -> impl Iterator { + pub fn into_iter(self) -> impl Iterator { self.nodes .into_iter() .map(|node|node.point) } + + #[inline] + pub fn iter(&self) -> impl Iterator { + self.nodes + .iter() + .map(|node|&node.point) + } } + + pub struct KdTreeNode { left_node: Option, right_node: Option, - point: T, dimension: usize, split_on: F @@ -328,6 +335,8 @@ impl> KdTreeNode { } } + + #[cfg(test)] mod tests { use crate::kdtree::test_common::Point2WithId;