geo icon indicating copy to clipboard operation
geo copied to clipboard

Relax constraints on `Coord` and associated structures

Open dsgallups opened this issue 1 year ago • 2 comments

  • [x] I agree to follow the project's code of conduct.
  • [ ] I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Hello! I am currently working on a rendering library for leptos, which uses geo. I would like to make interactive svgs in the dom, but that requires that some of the inner types of several geo-types structs should have their constraints relaxed.

This change does not affect current implementations in other crates, as these changes only allow types that are not CoordNum (but potentially implement Add or PartialEq, etc.) to access crate implementations.

The reasoning for keeping generics unconstrained on structs is identified in the Rust API Guide. This change is part of a series of processes to relax bounds as the geo ecosystem is extended.

  • Coord no longer has an impl constraint of CoordNum for its inner values
  • Rect<T>, LineString<T>, Line<T>,PointsIter<T> generic constraints have been relaxed.
  • Certain implementations have been relaxed for T across types to allow values to access identical functionality written by geo

Relates to #1169 and #1157. Relates to https://github.com/georust/geo-svg/issues/13 Thank you for your consideration!

dsgallups avatar Jul 29 '24 18:07 dsgallups

I think I understand how this change makes the code more mathematically "pure", but are you actually running into a problem with the current implementation? Can you succinctly describe that problem or point to some code which fails to compile?

michaelkirk avatar Jul 29 '24 19:07 michaelkirk

I think I understand how this change makes the code more mathematically "pure", but are you actually running into a problem with the current implementation? Can you succinctly describe that problem or point to some code which fails to compile?

Absolutely, will create an issue describing several examples of this. Thank you for considering my PR!

dsgallups avatar Jul 30 '24 14:07 dsgallups

Ran out of time and forgot about this

dsgallups avatar Sep 14 '24 12:09 dsgallups