bikeshedder / deadpool

Dead simple pool implementation for rust with async-await
Apache License 2.0
1.08k stars 137 forks source link

WASM support #322

Closed bikeshedder closed 6 months ago

bikeshedder commented 6 months ago

This issue tracks the progress of supporting WASM as a target.

bikeshedder commented 6 months ago

@shadaj Continuing our discussion from #316. I'm unsure if that's actually a case of rust-lang/cargo#1197.

If I'm not mistaken the conditional dependencies should work just fine with the latest Rust edition and resolver. :thinking:

Alternatively we could add a rt-tokio-1-wasm feature which does enable deadpool/rt-tokio-1 but not the runtime feature of the tokio-postgres crate. That way we could still keep it a single feature to enable for most of the users and only add a special WASM feature flag for WASM users.

As features are additive it would be best if this was "fixed" in tokio-postgres where the runtime becomes a no-op if compiling for WASM.

@sfackler, what are your thoughts on that?

bikeshedder commented 6 months ago

@shadaj btw. would you be willing to share some of the code you use to create connection to PostgreSQL with WASM? Could that actually be added to a WASM specific runtime feature to tokio-postgres or deadpool-postgres? That would make using PostgreSQL on WASM a lot easier for future developers, no?

bikeshedder commented 6 months ago

I just released :package: deadpool 0.12.1 and :package: deadpool-postgres 0.13.2. I had to make a release due to #320 and including the current feature guards shouldn't break anything even though WASM support is currently broken according to @shadaj.

shadaj commented 6 months ago

Ahhhhh, we had forgotten to include resolver = "2" in a downstream crate we're building with wasm-pack. So sorry for the confusion, it all works now! Will look into sharing some of the connection code we use for WASM.

bikeshedder commented 6 months ago

Great. So this can be closed. The just released versions of the crates fix this. :partying_face: