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
Fallible properties getter #9
Comments
I didn't consider this case. And I fear, that it could get more complicated for formats supporting an explict |
In the world I was envisioning, I thought a
Which would be different from a missing property:
Given:
Trying to parse out a JSON value when null is assigned:
I haven't looked deeply, but my assumption was that trying to parse a property into an incompatible type currently returns My hope is that people who want to maintain something like the existing usage would update their callsites to An alternative would be to leave the existing API as it is, and implement a parallel
Or have the "safe" explicit flavor be default, and let the people who want to YOLO type in a longer name like:
|
Reflecting a bit, maybe this one in particular is weird:
I could see people reasonably expecting:
|
Has been implemented in the meantime https://docs.rs/geozero/0.6.0/geozero/trait.FeatureProperties.html#method.property |
Following your link, I don't see where this changed. It looks like we still return
|
Sorry, I got into a issue closing fever... |
geozero 0.8.0 has a new property getter signature:
which has different errors for missing properties and properties with an unexpected type:
|
Thanks! |
Signature to get a property is:
But that doesn't allow you to distinguish between "property missing" and "invalid property" (and an error with details about why it's invalid).
I guess I was expecting some kind of Result rather than Option. Is that something you'd consider?
e.g. trying to parse a string field into an integer.
Maybe something like this:
The text was updated successfully, but these errors were encountered: