-
Notifications
You must be signed in to change notification settings - Fork 7
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
Async sensor API #2
base: master
Are you sure you want to change the base?
Conversation
If you're okay with this implementation I'll go ahead and fix CI and prepare for merge. |
Thank you for your proposal! I bet I got the idea and your implementation looks straightforward at a first glance. Looking at the CI builds, the error
looks like the dependency embedded-hal-async could not be build on stable. I would have expected this optional dependency not to be built at all in the actual CI configuration. Are you building with nightly? Have you encountered this issue and already looked into it? |
There's a all-features target in the CI at https://github.com/sirhcel/sht4x/blob/master/.github/workflows/ci.yml#L23-L26 for each one except rustfmt. This would have to be removed and two more branches added for blocking and async features, plus a test on nightly given that |
Please excuse me for my sluggish reply. Thank you for pointing me to the CI! I managed to setup a project for giving it a spin and your changes work like a treat. :) After some discussion about how to handle a sync and a async version of a crate, I'm currently inclined to release the sync and async variant as separate crates. My argument for this way is that you need either one or the other and this also will result in clean documentation on docs.rs. Since you created this PR, what's your opinion on thes points? Providing async support through a feature flag does not feel like the first-class citizen it should be. At least with respect to documentation. |
I was looking for an async sht4x library. @tazz4843, do you think you'll be publishing this as a different crate? For now I am just going to set the dependency as your github repo... |
To use it, need to set default-features to false. This might be a little confusing to new users of the library. Maybe it would be better not to have any default features selected. Then force the user to select async or blocking?
|
Currently untested, figured I would make the PR now to get some sort of feedback before I move any further. This is by far the easiest way of implementing it, with the mutually exclusive features. Having blocking enabled by default allows this to be a patch release if so desired.