rusqlite icon indicating copy to clipboard operation
rusqlite copied to clipboard

Add `wasm32-unknown-unknown` support

Open Spxg opened this issue 4 months ago • 7 comments

The main diff is to replace libsqlite3-sys with sqlite-wasm-rs on the wasm platform, while keeping everything else unchanged.

Previous PR: https://github.com/rusqlite/rusqlite/pull/1643

resolves https://github.com/rusqlite/rusqlite/issues/488 resolves https://github.com/rusqlite/rusqlite/issues/827 resolves https://github.com/rusqlite/rusqlite/pull/1010

Spxg avatar Dec 07 '25 10:12 Spxg

Something like: https://github.com/rust-random/getrandom/blob/8861a62a25cafad5a0cc5bc1f16715865b9d4456/tests/mod.rs#L4-L5

#[cfg(all(feature = "wasm_js", target_arch = "wasm32", target_os = "unknown"))]
use wasm_bindgen_test::wasm_bindgen_test as test;

doesn't work (instead of rusqlite-test-helper) ?

gwenn avatar Dec 07 '25 11:12 gwenn

doesn't work (instead of rusqlite-test-helper) ?

it requires adding this line of configuration to every test mod, which may not be the most convenient approach.

Spxg avatar Dec 07 '25 11:12 Spxg

% rg -F 'mod test' | wc -l
      41

vs

% rg -F '#[test]' | wc -l
     275

We don't have to think about wasm each time we add a test function (only when we add a test module)...

gwenn avatar Dec 07 '25 13:12 gwenn

We don't have to think about wasm each time we add a test function (only when we add a test module)...

done

Spxg avatar Dec 07 '25 14:12 Spxg

hmm, continuous-integration/appveyor/pr failure doesn't seem related to this PR

Spxg avatar Dec 08 '25 07:12 Spxg

hmm, continuous-integration/appveyor/pr failure doesn't seem related to this PR

Yep, you can ignore it. (I will try to merge your PR this week)

gwenn avatar Dec 08 '25 08:12 gwenn

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
#[deprecated(since = "0.33.0", note = "use trace_v2 instead")]
pub fn trace(&mut self, trace_fn: Option<fn(&str)>) {}

#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
#[deprecated(since = "0.33.0", note = "use trace_v2 instead")]
pub fn profile(&mut self, profile_fn: Option<fn(&str, Duration)> {}

sqlite_wasm_rs no longer bindgen sqlite3_trace and sqlite3_profile, so I configured them.

Spxg avatar Dec 09 '25 18:12 Spxg

Almost 5 years later Thanks.

gwenn avatar Dec 14 '25 09:12 gwenn