-
Notifications
You must be signed in to change notification settings - Fork 96
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
Replace OGRwkbGeometryType::Type
(a.k.a. c_uint) by enum GeometryType
#252
Comments
I'm in favor of wrapping these constants with enums.
|
I honestly don't know what would be the best solution here, but I want to understand why you want this change.
|
All of the above. Plus the ability to implement useful traits like |
What if we wrapped them in structs defined #[derive(PartialEq, Eq)]
struct GeometryType(u32);
impl GeometryType {
pub const Unknown: GeometryType = GeometryType(0);
pub const Point: GeometryType = GeometryType(1);
pub const LineString: GeometryType = GeometryType(2);
}
|
In what way is that better than an |
You're right, it's not much better than an enum with an |
Previously discussed on #250. The question was how extensible it should be, which I've briefly looked into.
gdal_sys
crate needs updating with every new release anyway due to the generated bindings, so adding new constants to the Rust enum manually should not be too much trouble. Or after the fact if nobody has a need for them yet.#[non_exhaustive]
so that client code is forced to reckon with new additions to the enum.Note that the issues are mostly hypothetical at the moment;
OGRwkbGeometryType
has the same values in all of the supported GDAL/OGR versions.The text was updated successfully, but these errors were encountered: