pub trait DefaultLength<Family> {
type Strategy: Default;
}Expand description
“Which length strategy do we pick by default for this CS family?”
Mirrors v1’s DefaultDistance
for the length algorithm — the Rust analogue of Boost’s
services::default_strategy<Geometry, cs_tag> in
strategies/length/services.hpp, specialised per CS in
strategies/length/{cartesian,spherical,geographic}.hpp.
Length is unary, so — unlike DefaultDistance — there is exactly
one family type parameter (there is no second geometry). Each
family reports its default length strategy:
impl DefaultLength<CartesianFamily> for CartesianFamily { type Strategy = CartesianLength; }
impl DefaultLength<SphericalFamily> for SphericalFamily { type Strategy = SphericalLength; }
impl DefaultLength<GeographicFamily> for GeographicFamily { type Strategy = GeographicLength; }The Strategy: Default bound matches Boost’s expectation that
services::default_strategy<...>::type is default-constructible.
Required Associated Types§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl DefaultLength<CartesianFamily> for CartesianFamily
Cartesian family defaults to CartesianLength.
impl DefaultLength<CartesianFamily> for CartesianFamily
Cartesian family defaults to CartesianLength.
Mirrors the services::default_strategy<Geometry, cartesian_tag>
specialisation in strategies/length/cartesian.hpp.
type Strategy = CartesianLength
Source§impl DefaultLength<GeographicFamily> for GeographicFamily
Geographic family defaults to GeographicLength.
impl DefaultLength<GeographicFamily> for GeographicFamily
Geographic family defaults to GeographicLength.
Mirrors the services::default_strategy<Geometry, geographic_tag>
specialisation in strategies/length/geographic.hpp.
type Strategy = GeographicLength
Source§impl DefaultLength<SphericalFamily> for SphericalFamily
Spherical family defaults to SphericalLength.
impl DefaultLength<SphericalFamily> for SphericalFamily
Spherical family defaults to SphericalLength.
Mirrors the services::default_strategy<Geometry, spherical_tag>
specialisation in strategies/length/spherical.hpp.