the .convert() function needs an input type with a bound constraint on Coord<T> and produce an output type with a bound constraint on Coord<T>. However, the way it is defined today forces the 2 concrete types to be the same.
pub fn convert<C, F>(&self, point: C) -> Result<C, ProjError>
where
C: Coord<F>,
F: CoordinateType;
But it doesn't have to be like this. We could define the function as follows.
pub fn convert<C, D, F>(&self, point: C) -> Result<D, ProjError>
where
C: Coord<F>,
D: Coord<F>,
F: CoordinateType;
Note however that this would be a breaking change for the crate proj as now, the expected type should be made explicit and type inference might not always be able to save you.
the
.convert()
function needs an input type with a bound constraint onCoord<T>
and produce an output type with a bound constraint onCoord<T>
. However, the way it is defined today forces the 2 concrete types to be the same.But it doesn't have to be like this. We could define the function as follows.
Note however that this would be a breaking change for the crate
proj
as now, the expected type should be made explicit and type inference might not always be able to save you.