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_immutable_within {
    ($comments:tt) => {
            #[doc = concat!$comments]
            #[inline]
            pub fn within<D>(&self, query: &[A; K], dist: A) -> Vec<NearestNeighbour<A, T>>
            where
                A: LeafSliceFloat<T> + LeafSliceFloatChunk<T, K>,
                D: DistanceMetric<A, K>,
                usize: Cast<T>,            {
                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
                A: LeafSliceFloat<T> + LeafSliceFloatChunk<T, K>,
                D: DistanceMetric<A, K>,
                usize: Cast<T>,            {
                // 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.
                self.nearest_n_within_exclusive::<D>(query, dist, std::num::NonZero::new(usize::MAX).unwrap(), true, inclusive)
            }
    };
}