Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.convert does not need to bind input type with output type #84

Open
woshilapin opened this issue Jun 21, 2021 · 0 comments
Open

.convert does not need to bind input type with output type #84

woshilapin opened this issue Jun 21, 2021 · 0 comments

Comments

@woshilapin
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant