georust / georust/proj

`.convert` does not need to bind input type with output type

Open
#84 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
186
Forks
63
PR merge metrics
No merged PRs in 30d

Description

the `.convert()` function needs an input type with a bound constraint on `Coord` and produce an output type with a bound constraint on `Coord`. However, the way it is defined today forces the 2 concrete types to be the same.

```rust
pub fn convert(&self, point: C) -> Result
where
C: Coord,
F: CoordinateType;
```

But it doesn't have to be like this. We could define the function as follows.

```rust
pub fn convert(&self, point: C) -> Result
where
C: Coord,
D: Coord,
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the `.convert()` implementation and its existing Rust tests in the proj crate. Check how the current generic signature is used and whether callers rely on type inference; this is done when differing input and output coordinate types are supported without leaving the documented breaking-change concerns unresolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.