diff --git a/rstar/CHANGELOG.md b/rstar/CHANGELOG.md index 1e9ff36..c54eecd 100644 --- a/rstar/CHANGELOG.md +++ b/rstar/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased + +## Added +- Added missing re-exports of nearest neighbor iterators so they can be named in downstream crates. ([PR](https://github.com/georust/rstar/pull/186)) + # 0.12.2 ## Changed diff --git a/rstar/src/algorithm/iterators.rs b/rstar/src/algorithm/iterators.rs index 0000289..56950e7 100644 --- a/rstar/src/algorithm/iterators.rs +++ b/rstar/src/algorithm/iterators.rs @@ -9,6 +9,7 @@ use crate::RTree; use smallvec::SmallVec; pub use super::intersection_iterator::IntersectionIterator; +pub use super::nearest_neighbor::{NearestNeighborDistance2Iterator, NearestNeighborIterator}; pub use super::removal::{DrainIterator, IntoIter}; /// Iterator returned by [`RTree::locate_all_at_point`]. diff --git a/rstar/src/algorithm/nearest_neighbor.rs b/rstar/src/algorithm/nearest_neighbor.rs index 698b26d..7a4f23c 100644 --- a/rstar/src/algorithm/nearest_neighbor.rs +++ b/rstar/src/algorithm/nearest_neighbor.rs @@ -2,6 +2,9 @@ use crate::node::{ParentNode, RTreeNode}; use crate::point::{min_inline, Point}; use crate::{Envelope, PointDistance, RTreeObject}; +#[cfg(doc)] +use crate::RTree; + use alloc::collections::BinaryHeap; #[cfg(not(test))] use alloc::{vec, vec::Vec}; @@ -51,7 +54,10 @@ impl<'a, T> NearestNeighborDistance2Iterator<'a, T> where T: PointDistance, { - pub fn new(root: &'a ParentNode, query_point: ::Point) -> Self { + pub(crate) fn new( + root: &'a ParentNode, + query_point: ::Point, + ) -> Self { let mut result = NearestNeighborDistance2Iterator { nodes: SmallHeap::new(), query_point, @@ -106,6 +112,7 @@ where } } +/// Iterator returned by [`RTree::nearest_neighbor_iter_with_distance_2`]. pub struct NearestNeighborDistance2Iterator<'a, T> where T: PointDistance + 'a, @@ -118,7 +125,10 @@ impl<'a, T> NearestNeighborIterator<'a, T> where T: PointDistance, { - pub fn new(root: &'a ParentNode, query_point: ::Point) -> Self { + pub(crate) fn new( + root: &'a ParentNode, + query_point: ::Point, + ) -> Self { NearestNeighborIterator { iter: NearestNeighborDistance2Iterator::new(root, query_point), } @@ -136,6 +146,7 @@ where } } +/// Iterator returned by [`RTree::nearest_neighbor_iter`]. pub struct NearestNeighborIterator<'a, T> where T: PointDistance + 'a,