Closed shadaj closed 6 months ago
For tests, let me look into adding CI logic to test at least compilation on WASM.
In theory, the new CI config should test compilation on WASM!
I just removed the runtime
feature replacing it by conditional dependencies instead:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio-postgres = "0.7.9"
[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio-postgres = { version = "0.7.9", default-features = false }
Could you please check if that works for you?
This should be a non breaking release for non-WASM targets now.
@bikeshedder oh actually I think this doesn't work, due to https://github.com/rust-lang/cargo/issues/1197
In our downstream crates we are seeing the default features pulled in when compiling on WASM.
Currently,
deadpool-postgres
only offers APIs for creating pools that instantiate their underlying connections based on atokio_postgres::Config
. In some situations (mocking, custom networking), it is useful to provide an alternate connection mechanism. Thankfully,deadpool-postgres
already has theClient
trait for this so we just need to expose it publicly. As part of this, we also expose the existingConnectImpl
as a publicConfigConnectImpl
for code that needs to abstract over a selection of connection strategy.Our main use case for this is to enable use on WASM, where
tokio_postgres
is already supported but does not have thetokio-postgres/runtime
feature enabled (which enables the APIs for creation based on a database URL). So this PR also adds aruntime
feature that maps to the underlyingtokio-postgres
one for now (defaulting to true to preserve compatibility). It also includes a minor patch to disable thekeepalives_idle
config on WASM where it is not supported.