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
Use winapi crate instead of windows crate #35
Conversation
Yes, I was a little surprised that But with this PR, I am concerned that increases dramatically the amount of code to be maintained here. Also, I assumed due to Microsoft's own support that At the time of bumping the MSRV here, I checked into the issue "does updating MSRV imply the semver should be bumped to indicate a breaking change?" to which I found the general consensus to be "no" because a) people can painlessly update, b) otherwise people have Due to those reasons, I am hesitant about the switch to |
It's difficult. I for one am not even sure what's stopping people from simply using the most current stable rust version, but I guess there's a bunch of Centos users out there. :) The windows crate (probably) is the future, but I think it's still in its infancy with many breaking changes between versions. (But don't take my word for it, because I'm neither a windows user nor do a program for windows normally.) It's too bad that the winapi crate is not supported by a team, esp. since its used by fundamental crates like tokio. My code is ugly, but I don't think that there is the need to ever touch it again. I added few comments, but I don't think that it's easy to read or understand. I would totally understand if you choose not to adopt my PR. |
This reduces the minimum supported rust version by quite a lot.
I included the Cargo.lock so cargo audit works. |
//! # mod chrono_tz { pub type Tz = String; } | ||
//! // Get the current time zone as a string. | ||
//! let tz_str = iana_time_zone::get_timezone()?; | ||
//! let tz_str = iana_time_zone::get_timezone().unwrap(); | ||
//! println!("The current time zone is: {}", tz_str); | ||
//! | ||
//! // Convert the time zone string to a `chrono-tz::Tz` variant. | ||
//! let tz: chrono_tz::Tz = tz_str.parse().map_err(|e| anyhow::anyhow!("Error: {}", e))?; | ||
//! let tz: chrono_tz::Tz = tz_str.parse().unwrap(); | ||
//! println!("The current time zone is: {}", tz); | ||
//! # Ok(()) | ||
//! # } | ||
//! ``` |
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 is little need to actually use chrono-tz in the example. It has open security advises, increases the build time, and increases the MSRV to 1.40, when the library itself could be 1.38.
The argument that tokio uses |
It wasn't mentioned here I hope you are aware, but there is |
When you look at the history of their Cargo.lock, you'll see that they randomly bump their msrv every other release. It's still quite an old rust version they need, but I don't think their release pattern makes the |
You are right about that. To defend the crate, the maintainers seem to have some thoughts on this matter: microsoft/windows-rs#1987 (more of a joke: considering only this point, |
[Some time ago] I spoke in favor of using [`winapi`] instead of [`windows-sys`], because it had fewer msrv bumps, and because it was used by e.g. `tokio`, and `chrono`, so even if it was not being developed for anymore, it still had a ton of users who would hopefully notice any bugs. By now `tokio` has switched to `windows-sys`, and `chrono` will too in the next release. I guess it's time then to make the switch, too. [Some time ago]: strawlab#35 [`winapi`]: https://crates.io/crates/winapi [`windows-sys`]: https://crates.io/crates/windows-sys
This reduces the minimum supported rust version by quite a lot.