Initial port to async/await with smol#146
Conversation
max-baz
left a comment
There was a problem hiding this comment.
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.... 🙈 ) |
|
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
v4landwaylandcrates 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::spawnsmol::unblockstd::mpscchannels with smol channels.Box-ing it.mockallcan 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/Optionhas been rewritten with plain logic as the closures given to these functions cannot support async code.std::sync::Mutexhas been replaced withsmol::lock::MutexErrorBoxfor 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.