Skip to content
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

Replace windows-sys with windows #1976

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from
Draft

Replace windows-sys with windows #1976

wants to merge 2 commits into from

Conversation

pronebird
Copy link
Contributor

@pronebird pronebird commented Jan 22, 2025

This is a backburner PR for replacing windows-sys with windows crate.

It started as a side effort to update to windows-sys 0.59, which immediately caused issues with socket2 due to peer dependency conflict with windows-sys. Upon further inspection, I realized that we don't really use socket2 for anything but converting between windows native net types and Rust std::net types.

Now the reasons to go with windows instead of lower level windows-sys:

  • Support for most of non-fallible conversions between SOCKADDR_INET, SOCKADDR_IN, SOCKADDR_IN6, IN_ADDR, IN6_ADDR and IP{v4,v6}Address, SocketAddr, SocketAddrV4, SocketAddrV6
  • Fallible WinAPI calls return windows::core::Result
  • Fallible WinAPI calls returning WIN32_ERROR can be turned into windows::core::Result by calling ok() which removes the need for win32_err macro
  • We can remove socket2 from dependencies and only implement a single missing conversion from SOCKADDR_INET to SocketAddr

This change is Reviewable

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.

1 participant