-
Notifications
You must be signed in to change notification settings - Fork 6
fix: Making Wkb::buf() return slices containing only the WKB and trim the trailing data
#88
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
32a6552 to
598f9d8
Compare
598f9d8 to
63e52df
Compare
| /// See page 65 of <https://portal.ogc.org/files/?artifact_id=25355>. | ||
| #[derive(Debug, Clone, Copy)] | ||
| pub struct Coord<'a> { | ||
| /// The underlying WKB buffer |
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.
It would be great to add comments here saying that this buffer is solely the length of one coordinate
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.
Actually, we do not have this requirement for Coord here. The Coords are constructed using buffers with trailing data, and slicing is only handled in Coord::coord_slice.
I can also slice buf when constructing the Coord, which will make Coord.buf consistent with other types: buf contains only the data needed by that object.
| impl<'a> Coord<'a> { | ||
| pub(crate) fn new(buf: &'a [u8], byte_order: Endianness, offset: u64, dim: Dimension) -> Self { | ||
| pub(crate) fn new(buf: &'a [u8], byte_order: Endianness, dim: Dimension) -> Self { | ||
| Self { |
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.
Perhaps it would be descriptive to add a
debug_assert_eq!(buf.length(), dim.size() * F64_WIDTH)in this new()?
🤷♂️
|
Thanks! |
|
Awesome! |
|
@kylebarron Hi Kyle, can you create a new release? We need this to make a new release of SedonaDB. Thank you! |
|
I've been busy with conferences and vacation; I just published 0.9.2 |
CHANGES.mdif knowledge of this change could be valuable to users.Fix #86
This is a follow-up of #87. We refactored the code to remove the
buffield fromWkband addbufmethods for geometry types to return sliced WKB buffers. There are also some refactorings to simplify various offset computations included in this PR.