Skip to main content

distance_with

Function distance_with 

Source
pub fn distance_with<A, B, S>(a: &A, b: &B, strategy: S) -> S::Out
where A: Geometry, B: Geometry, S: DistanceStrategy<A, B>,
Expand description

Distance between two geometries using an explicit strategy.

Mirrors the with-strategy overload boost::geometry::distance(g1, g2, strategy) from boost/geometry/algorithms/distance.hpp and the dispatch in boost/geometry/algorithms/detail/distance/interface.hpp.

The C++ overload is spelled the same as the strategy-less one and disambiguated by SFINAE on the strategy concept; on the Rust side the two overloads become two distinct names (distance and distance_with) so the strategy argument never clashes with the strategy-less form during type inference.

Taking the strategy by value (rather than by reference, as Boost does with Strategy const& at boost/geometry/algorithms/detail/distance/interface.hpp:68) keeps the call site free of an & everyone would forget. Concrete strategies are zero-sized or pointer-sized configuration objects (Pythagoras, Haversine, Andoyer { spheroid }), so passing them by value monomorphises into nothing.