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

use geometry::* to concisely include all the geometry variants #853

Merged
merged 6 commits into from
Jun 24, 2022

Conversation

michaelkirk
Copy link
Member

@michaelkirk michaelkirk commented Jun 23, 2022

  • 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.

Fixes #831 - an ergonomics issue.

So you can now:

- use geo_types::{Coordinate, Point, Line, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, Rect, Triangle, Geometry, GeometryCollection};
+ use geo_types::geometry::*

And similarly with geo:

- use geo::{Coordinate, Point, Line, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, Rect, Triangle, Geometry, GeometryCollection};
+ use geo::geometry::*

(quoting from #831):

In general, I'm not a fan of large wild card imports because later in the code it's hard to know where something came from, but for cases like this when it's a small number of well known things, I think it's helpful with little downside.

Note that I diverged slightly from my original plan in #831.

I initially sought to introduce a new geometries module, but then I was afraid it'd be too confusing to have both a geometry and a geometries module, so opted instead to have a geometry module which, as well as defining the Geometry enum, also re-exports the inner variants.

@@ -49,7 +46,7 @@ use num_traits::Float;
/// ```
pub trait ChamberlainDuquetteArea<T>
where
T: Float + CoordNum,
T: CoordFloat,
Copy link
Member Author

@michaelkirk michaelkirk Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These CoordFloat changes are an unrelated no-op cleanup. I just prefer to uniformly reference our internal types over the num_types.

Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sgtm!

@michaelkirk
Copy link
Member Author

bors r=frewsxcv

(rebased)

@bors
Copy link
Contributor

bors bot commented Jun 24, 2022

Build succeeded:

@bors bors bot merged commit a122694 into main Jun 24, 2022
@bors bors bot deleted the mkirk/geom-module branch June 24, 2022 00:46
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

Successfully merging this pull request may close these issues.

create a geo::geometries module that re-exports all the geometry members
2 participants