-
Notifications
You must be signed in to change notification settings - Fork 28
wkt! macro for compile time checking of static WKT text
#137
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
Conversation
|
I think all the primitive types now work; still working through edge cases with Geometry collections. E.g. this doesn't fail to compile: Edit: Fixed in |
wkt! macro for compile time checking of static WKT text
|
I wonder if there's an easy way to write a literal that gets parsed as both rust source code and a string literal? Because then we can just use |
|
Note: This PR doesn't currently handle closing of polygons, like the |
### Change list - Includes copied in data from https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src.yaml and https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src_generated.yaml. By copying in the data, we can pass the WKT strings to the `wkt!` macro (georust/wkt#137) - It includes all geometry types except for `geometrycollection-nested`, which we leave for the future. - This PR just defines the test data; it doesn't add it to any tests yet. cc @paleolimbot
For the same reason, I agree! |
Seems like it should be doable with a custom test macro that utilizes |
Upon closer read, I don't think it's
💯 I hadn't been aware of |
|
I used this branch last night in geoarrow/geoarrow-rs#1043 and it worked like a charm. See https://github.com/geoarrow/geoarrow-rs/pull/1043/files#diff-cfdac2ccc25441e1e7f36dda38525bb4468123e46129cb6c8ca5d267ff3db0c5 |
|
I updated this for the newly-fallible constructors in |
michaelkirk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
A couple little nits in the tests with some commented out tests - either (preferred) uncomment them, or delete them if that's complicated for some reason.
Thanks for writing all these tests!
The implementation is a little verbose, and I have some ideas for patterning out the macros, but I can do that in a followup.
### Change list - Includes copied in data from https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src.yaml and https://github.com/geoarrow/geoarrow-data/blob/3feaaa0b56758e2b5d7afc1c44c6555cb589d295/example/example_src_generated.yaml. By copying in the data, we can pass the WKT strings to the `wkt!` macro (georust/wkt#137) - It includes all geometry types except for `geometrycollection-nested`, which we leave for the future. - This PR just defines the test data; it doesn't add it to any tests yet. cc @paleolimbot


CHANGES.mdif knowledge of this change could be valuable to users.Originally copied from the
wkt-typesimplementation but then started copying from #112, since that looked to have nicer separation of concerns.This is implemented on top of #135 and that should be merged first.
Closes #112 Closes #132