-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Hello! I'm working on a project that compiles to WASM and would love to use taskchampion
as a library. Currently, this isn't possible due to a dependency that doesn't support the wasm32-unknown-unknown
target.
This issue proposes a non-breaking change to add first-class support for using taskchampion
in a WASM and async
context.
The Problem
When attempting to compile taskchampion
for a WASM target, the build fails:
- UUID Generation: The
uuid
crate's defaultv4
feature relies on OS-level random number generation, which is not available in WASM.
Proposed Solution
I propose introducing a new wasm
feature flag. When a user enables this feature and disables default features, the library will be fully WASM-compatible.
A consumer of the library would use it in their Cargo.toml like this:
[dependencies]
taskchampion = { version = "...", default-features = false, features = ["wasm"] }
This approach is fully backward-compatible and requires no changes for existing users.
Implementation Plan
I plan to submit a pull request with several small, logical commits to implement this. Each commit will represent a focused step in the process, making the changes easier to review.
- Add
wasm
feature and configureuuid
* Add the newwasm = ["uuid/js"]
feature toCargo.toml
.
* This configures theuuid
crate to use the browser's random number generator when thewasm
feature is active. - Introduce the
AsyncServer
trait
* Add theasync-trait
dependency.
* Define a newpub trait AsyncServer
, mirroring the synchronousServer
trait, to provide a clear interface for non-blocking server implementations. - Implement
async
synchronization
* Implement the core async logic in a newtaskdb/async_sync.rs
module.
* Add the public-facingasync fn sync_async(...)
methods toReplica
andTaskDb
.
This will make taskchampion a much more versatile library and open it up to a new ecosystem of web and serverless applications. I'm happy to discuss this proposal and am open to any feedback.
Thank you!
-Geoff
Metadata
Metadata
Assignees
Labels
Type
Projects
Status