Conversation
|
This should be enough for us to publish v2.0.0, we still need to figure out how to fix #47 for platforms that busy loop. |
|
I think this is going in the opposite direction of where we should be going. We only have a real async implementation for one platform (Freedesktop). The others are just sync or busy polling, neither of which are useful to wrap in an async API. It's the not-really-async APIs that should be removed. Async should only be available for platforms we actually have async implementations.
Most Rust GUI libraries are not async executors. |
|
So you are suggesting that we provide an async API for platforms that support it and leave the others sync? That could complicate things for the user as they would have to do conditional compilation. |
This commit reverts the split API implementation. The crate now simply provides a sync `detect` method and `subscribe` remains async, also removed `notify` files.
- Added `Error` struct. - Added `Result` return type to methods. - Added justfile to facilitate building multiple platforms. - Updated README.md
41c226c to
f976c33
Compare
e2d68dc to
0c2d750
Compare
|
Alright, I believe you'll find this acceptable @Be-ing
As per your suggestion, the plan is to add support to other platforms later on and avoid busy looping. |
Oh, that's a nice idea to avoid conditional compilation. Then if/when people contribute subscribe implementations for other OSes, it'll just work for downstreams with I'll look at this in detail tomorrow. |
Be-ing
left a comment
There was a problem hiding this comment.
Overall looks pretty good, just a few small comments
|
I'll try to make the requested changes today and merge it after, thanks! |
|
Fixes #21 |
This pull request improves error handling, removes synchronous support and updates the Rust edition.
Note
Given that this crate is aimed at desktop applications, the need to keep a sync API is unnecessary, every GUI toolkit should provide a way to execute async code, and thus, dark-light will be switching to async methods.
Changes
thiserroras a dependency inCargo.toml.Errorenum insrc/error.rsto handle various error cases, including detection failures and XDG Desktop Portal communication issues.detectandsubscribefunctions across different platforms to returnResulttypes instead of fallbacks.syncfeature references inCargo.toml,README.md, and thesrc/lib.rsfile.README.mdto reflect changes in the supported platforms and the new asynchronous API usage.justfilefor building and testing the crate across different targets.Modeenum to replaceDefaultwithUnspecifiedand added utility methods for checking the mode.