kiddo 5.3.1

A high-performance, flexible, ergonomic k-d tree library. Ideal for geo- and astro- nearest-neighbour and k-nearest-neighbor queries
Documentation
#[doc(hidden)]
#[macro_export]
macro_rules! generate_within {
    ($comments:tt) => {
            #[doc = concat!$comments]
            #[inline]
            pub fn within<D>(&self, query: &[A; K], dist: A) -> Vec<NearestNeighbour<A, T>>
            where
                D: DistanceMetric<A, K>,
            {
                self.within_exclusive::<D>(query, dist, true)
            }

            #[doc = concat!$comments]
            #[inline]
            pub fn within_exclusive<D>(&self, query: &[A; K], dist: A, inclusive: bool) -> Vec<NearestNeighbour<A, T>>
            where
                D: DistanceMetric<A, K>,
            {
                // Like [`within`] but allows controlling boundary inclusiveness.
                //
                // When `inclusive` is true, points at exactly the maximum distance are included.
                // When false, only points strictly less than the maximum distance are included.
                let mut matching_items = self.within_unsorted_exclusive::<D>(query, dist, inclusive);
                matching_items.sort();
                matching_items
            }
    };
}