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

Migrate from winapi to windows-sys #56

Open
jessebraham opened this issue Jun 21, 2022 · 4 comments
Open

Migrate from winapi to windows-sys #56

jessebraham opened this issue Jun 21, 2022 · 4 comments
Labels
help wanted Extra attention is needed windows This issue is specific to Windows systems

Comments

@jessebraham
Copy link
Member

The winapi crate is no longer maintained, and Microsoft are now maintaining the windows-sys crate (among others), so we should migrate to this.

@jessebraham jessebraham added help wanted Extra attention is needed windows This issue is specific to Windows systems labels Jun 21, 2022
@DoumanAsh
Copy link

I would recommend not to hurry with it because windows-sys makes semver incompatible bumps with each new version so it would become annoying and eventually stale in this crate

@caspermeijn
Copy link

Today I tried this conversion, but it is currently not straightforward.

The DCB struct has a lot of bitfields, which are much used in serialport. The bitfields don't have easy getters/setters yet: microsoft/windows-rs#2942 Therefore doing the conversion today would decrease the code readability.

@sirhcel
Copy link
Contributor

sirhcel commented Sep 26, 2024

Thank you for attempting the migration @caspermeijn! Do you have some work-in-progress to share with us (at best in a fork) so that I can have a look at how exactly this gets messy?

@caspermeijn
Copy link

Thank you for attempting the migration @caspermeijn! Do you have some work-in-progress to share with us (at best in a fork) so that I can have a look at how exactly this gets messy?

This was my work in progress commit: caspermeijn@58ab9ba

I didn't work on the bit fields when I saw the mentioned lack of support. The problem comes down to this:
DCB::_bitfield is an integer field, but it represents multiple bit fields. The windows-rs crate doesn't provide any help, so serialport needs to maintain a list of the bit indexes. That sounded like not the core competency of this crate and should be provided by a Windows API crate instead. The maintainer of windows-rs seems to be aware of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed windows This issue is specific to Windows systems
Projects
None yet
Development

No branches or pull requests

4 participants