Skip to content

DRY up WKT macros#142

Merged
michaelkirk merged 3 commits intomainfrom
mkirk/dryer-wkt-macro
Apr 24, 2025
Merged

DRY up WKT macros#142
michaelkirk merged 3 commits intomainfrom
mkirk/dryer-wkt-macro

Conversation

@michaelkirk
Copy link
Copy Markdown
Member

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

@michaelkirk michaelkirk requested a review from kylebarron April 17, 2025 04:23
@michaelkirk michaelkirk force-pushed the mkirk/dryer-wkt-macro branch from 649dd34 to a785d39 Compare April 17, 2025 04:37
@michaelkirk michaelkirk force-pushed the mkirk/dryer-wkt-macro branch from a785d39 to c622f69 Compare April 17, 2025 04:47
Comment thread src/wkt_macro.rs Outdated
]).unwrap()
};
#[allow(unused)]
const fn equal_dims(a: Dimension, b: Dimension) -> bool {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need to be pub to be accessible from the macro outside of this repo?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

image Looks like it

Comment thread src/wkt_macro.rs Outdated
macro_rules! geometry_collection {
(EMPTY) => {
GeometryCollection::empty(Dimension::XY)
$crate::types::GeometryCollection::empty(Dimension::XY)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need to be

Suggested change
$crate::types::GeometryCollection::empty(Dimension::XY)
$crate::types::GeometryCollection::empty($crate::types::Dimension::XY)

Comment thread src/wkt_macro.rs Outdated
macro_rules! multi_polygon_m {
(()) => {
compile_error!("use `MULTIPOLYGON M EMPTY` for a MultiPolygon with no coordinates")
$crate::types::MultiPolygon::empty(Dimension::XY)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
$crate::types::MultiPolygon::empty(Dimension::XY)
$crate::types::MultiPolygon::empty($crate::types::Dimension::XY)

@kylebarron kylebarron mentioned this pull request Apr 17, 2025
3 tasks
@kylebarron
Copy link
Copy Markdown
Member

geoarrow/geoarrow-rs#1061 compiles without errors using the branch in #143 with a couple macro hygiene updates

@kylebarron
Copy link
Copy Markdown
Member

This is way more concise and elegant than my version 🙂

@kylebarron kylebarron mentioned this pull request Apr 17, 2025
@michaelkirk michaelkirk merged commit 503c7e6 into main Apr 24, 2025
1 check passed
@michaelkirk michaelkirk deleted the mkirk/dryer-wkt-macro branch April 24, 2025 19:11
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.

2 participants