-
-
Notifications
You must be signed in to change notification settings - Fork 32
Initial port to async/await with smol #146
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
Conversation
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.
This looks very interesting and promising, leaving some initial feedback - thank you so much for working on this!
@LordMZTE thanks for the latest changes! Would you be able to review some of my latest commits? It seems to compile, but I can't e.g. actually test whether iio sensors still work as expected - just to be extra sure 🤞 ( ...I have a soft spot for the monadic style in Rust.... 🙈 ) |
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.
Thanks for you work! Here are some thoughts.
I can also confirm that everything still works with an IIO sensor.
Thanks for the continuous feedback :) By the way, I really didn't mean to steal all the fun, you are very welcome to push improvements directly 😁 Do you think this is in a good shape to merge, are there more things you would like to do here, or in another PR? |
No worries, I really appreciate the help! I can't think of anything else to do in this PR, so I'd be alright with merging. The next PR will probably be de-sleep-looping some of the controllers :D |
This acts an an initial port to async/await using the smol runtime. The only parts of the codebase that still use regular threads and blocking IO should be the webcam ALS and the wayland capturer, as the
v4l
andwayland
crates don't yet have support for async IO. No sleep loops have been removed yet, but this should make it easier to do so as we've discussed in #143.Work done
smol::spawn
smol::unblock
std::mpsc
channels with smol channels.Box
-ing it.mockall
can no longer generate a mock implementation forBrightness
. Tests that use mocking have been commented out for now. I think this might be best left to another PR.Result
/Option
has been rewritten with plain logic as the closures given to these functions cannot support async code.std::sync::Mutex
has been replaced withsmol::lock::Mutex
ErrorBox
for boxed errors has been created as the type got a few more trait bounds now. We already transitively depend on anyhow, perhaps we should use that for error handling in the future.assert_eq!(true, x)
->assert!(x)
All tests pass and wluma has been tested with the IIO sensor ALS on wayland/River.