-
Notifications
You must be signed in to change notification settings - Fork 46
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
Make PjInfo struct public #133
Conversation
src/proj.rs
Outdated
@@ -1018,6 +1018,8 @@ impl convert::TryFrom<(&str, &str)> for Proj { | |||
} | |||
} | |||
|
|||
/// Info about the current PROJ definition | |||
#[derive(Copy, Clone, Debug)] | |||
struct PjInfo { |
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.
struct PjInfo { | |
pub struct PjInfo { |
😉
Also, I don't think it can be Copy
- only Clone
- because of the String
fields.
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.
🤦 night-PR strikes again
Co-authored-by: Corey Farwell <[email protected]>
src/proj.rs
Outdated
/// | ||
/// [PROJ reference documentation](https://proj.org/development/reference/datatypes.html?highlight=has_inverse#c.PJ_PROJ_INFO) | ||
#[derive(Clone, Debug)] | ||
pub struct PjInfo { |
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.
pub struct PjInfo { | |
pub struct ProjInfo { |
Since this was private, we can freely change the name. I think it's nice to match the upstream name, or at least idiomatically translate them.
This is completely subjective, so feel free to take it or leave it.
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.
We already have a Projinfo
: https://docs.rs/proj/latest/proj/struct.Projinfo.html
...which comes from PJ_INFO
. Agreed that your naming more accurately maps to the underlying structures
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.
ahah oh darn, good point @frewsxcv.
With perfect hindsight, maybe an idiomatic conversion would map PJ_INFO
to proj::Info
and PJ_PROJ_INFO
to proj::ProjInfo
But, I'd understand if doing that whole swap is more work/confusion than it's worth.
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.
Ah yes, and I've broken the build. Swapping will be a breaking change, won't it? (Not necessarily a reason not to do it…)
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.
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.
Swapping will be a breaking change, won't it?
I don't think so? I think you'd just need to correspondingly rename the (here-to-fore private) usages of PjInfo.
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.
We can't use Info
because we have a public trait named Info
: https://github.com/georust/proj/blob/main/src/proj.rs#L231
😭
Anyone got a good suggestion for an alternative name?
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 my gosh what a pjckle. I surrender. 🏳️
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.
Ok wait, I think I have a proposal. One minute.
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.
Proposal: #134
I think it puts us in a nice place, but it's got some downsides - I know you're no fan of macros, and it's potentially confusing to replace a trait with a struct of the same name, so no hard feelings if you'd prefer to just leave the names as they are.
Co-authored-by: Michael Kirk <[email protected]>
`use proj::Info` to have access to these methods. This is a nice convenience, but especially important because we want to have `use proj::Info` refer to the newly renamed `Info` struct, not the legacy `Info` trait. So now, instead of legacy people getting a confusing method for trying to use the legacy trait, they'll just see an "unused import" warning.
I've merged #134, but even though there's now a |
Addressed in #136
Yes, this is pretty maddening. 😆 I know it was my suggestion, but upon reflection, even though it's an idiomatic translation, I think that would contrast better with
|
Yeah I think that's much clearer! Do you want to leave #136 as is, and I'll merge it tomorrow then do the rename in here? |
SGTM! |
make `fn proj_info` public
OK, this is done! |
/// | ||
/// # Safety | ||
/// This method contains unsafe code. | ||
pub fn lib_info(&self) -> Result<Info, ProjError> { |
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.
I guess this is a breaking change now, but I think it's the right thing to do now that there is another *info
method. I also don't expect very many people are actually using it.
Probably worth a new release note though - something like:
BREAKING: Getting information about the version of libproj installed was renamed from
proj.info()
toproj.lib_info()
Co-authored-by: Michael Kirk <[email protected]>
bors r+ |
Build succeeded: |
135: Bump proj-sys to use PROJ 9.0.1 r=urschrei a=urschrei This will be rebased against #133 when it merges – there are no changes to `proj`. This PR bumps `PROJ` to v9.0.1. It's a bugfix release. Full list of fixes is here: https://github.com/OSGeo/PROJ/releases/tag/9.0.1 Note that I haven't bumped the CI PROJ versions as there should be no compat issues (although we're about to find out): The EPSG version has also been updated so we may initially see some test errors in `proj` where the bundled binary is in use. Co-authored-by: Stephan Hügel <[email protected]>
Good job getting this merged! Sorry for turning it into such an odyssey. 😬 |
No, I'm very happy with where it ended up, so def worth it, I think! |
Fixes #131