Skip to content

Expose APIs for accessing the underlying WKB buffer to implement various functions efficiently#85

Merged
kylebarron merged 2 commits intogeorust:mainfrom
Kontinuation:expose-more-apis
Sep 30, 2025
Merged

Expose APIs for accessing the underlying WKB buffer to implement various functions efficiently#85
kylebarron merged 2 commits intogeorust:mainfrom
Kontinuation:expose-more-apis

Conversation

@Kontinuation
Copy link
Copy Markdown
Contributor

@Kontinuation Kontinuation commented Sep 29, 2025

  • 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.
  • I ran cargo fmt

This work originates from SedonaDB. We have implemented a fast WKB to GEOS geometry conversion function in our own fork of wkb: wherobots#2, which requires access to the underlying WKB buffer and structs defined for individual geometry types. Having access to these implementation details allows us to make this particular task 4 times faster.

I believe that there might be other scenarios where having access to the raw WKB buffer will help a lot, so I added several methods for exposing slices of WKB buffers and some metadata about the encoded coordinates.

impl<'a> GeometryCollection<'a> {
/// Construct a new GeometryCollection from a WKB buffer.
///
/// This will parse the WKB header and extract all contained geometries.
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.

On the contrary, I planned to make all of these constructors pub(crate) #75

I don't think these constructors are currently publicly accessible (since these modules aren't public), so I don't think it should be a breaking change.

Is there any reason why you would want these constructors to be public?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't need these constructors to be public, the comments added to these methods were just for passing the missing_docs check.

I'll submit another commit to mark these fn try_new constructors pub(crate) and also remove unused fn new constructors.

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.

Perfect, thank you!

Copy link
Copy Markdown
Member

@kylebarron kylebarron left a comment

Choose a reason for hiding this comment

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

Thank you!

@kylebarron kylebarron merged commit 130eb0c into georust:main Sep 30, 2025
1 check passed
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