-
Notifications
You must be signed in to change notification settings - Fork 25
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
Implement geo-traits for writing to WKT & perf improvement #124
Merged
Merged
Changes from 16 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
71c6b5b
initial direct approach
kylebarron afd4305
WKT writer using geo traits
kylebarron f351816
fix tests
kylebarron 63b1324
update bench
kylebarron 599c68f
Fix implementation for rect, triangle, line
kylebarron e04b751
shorten name
kylebarron f3434f5
expose via `wkt::to_wkt` mod
kylebarron 1cd7f54
Merge branch 'kyle/geo-traits' into kyle/geo-traits-writer
kylebarron 6b57a1c
update for geo-traits 0.2
kylebarron 9b23f7b
fix compile
kylebarron 447be53
Remove CoordNum bound
kylebarron 3f13150
Merge branch 'main' into kyle/geo-traits-writer
kylebarron d5e4bfd
Add error enum
kylebarron 5bda2dc
Update writing rect
kylebarron 96666da
fix compile
kylebarron 9760faf
update comment
kylebarron f140289
Use core::fmt
kylebarron f4af2cf
standardize on std::fmt
kylebarron 11d209c
Use `Error` instead of `std::error::Error`
kylebarron 6f49994
add_coord -> write_coord
kylebarron aee9ab3
Inline impl Write
kylebarron 6ab501c
reorder writer param
kylebarron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use core::fmt; | ||
|
||
use thiserror::Error; | ||
|
||
/// Generic errors for WKT writing and reading | ||
#[derive(Error, Debug)] | ||
pub enum Error { | ||
#[error("Only 2D input is supported when writing Rect to WKT.")] | ||
RectUnsupportedDimension, | ||
#[error("Only defined dimensions and undefined dimensions of 2, 3, or 4 are supported.")] | ||
UnknownDimension, | ||
/// Wrapper around `[std::fmt::Error]` | ||
#[error(transparent)] | ||
FmtError(#[from] std::fmt::Error), | ||
} | ||
|
||
impl From<Error> for fmt::Error { | ||
fn from(value: Error) -> Self { | ||
match value { | ||
Error::FmtError(err) => err, | ||
_ => std::fmt::Error, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit:
std::fmt
here, butcore::fmt
at the top — settle on one.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.
Oh, oops. I don't actually know the difference between
std
andcore
. I changed tostd
everywhere. I hope that's okThere 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.
core is a subset of std.
std re-exports all of core and then has some other fancier functionality. So referencing things from core or std is equivalent, it just makes me twitch a little to see both used interchangeably in such close proximity. 🤪
The distinction is typically only relevant if you are trying to target a no-std build for very lightweight platforms (like an embedded system) which might not have support for the std lib.