diff --git a/diesel/Cargo.toml b/diesel/Cargo.toml index 8e1b8225ecf9..5cc59704cdb2 100644 --- a/diesel/Cargo.toml +++ b/diesel/Cargo.toml @@ -53,7 +53,7 @@ path = "../diesel_derives" libsqlite3-sys = { version = ">=0.17.2, <0.31.0", optional = true, features = ["bundled_bindings"] } [target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies] -sqlite-wasm-rs = { version = "0.1.1", optional = true } +sqlite-wasm-rs = { version = ">=0.1.2", optional = true } [dev-dependencies] cfg-if = "1" diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs index 503975e42b56..25ce2aaee0b4 100644 --- a/diesel/src/lib.rs +++ b/diesel/src/lib.rs @@ -768,13 +768,17 @@ pub mod prelude { #[cfg(feature = "sqlite")] #[doc(inline)] pub use crate::sqlite::SqliteConnection; - // Before using C-API, you must initialize sqlite. + + // These exported APIs from `sqlite-wasm-rs` are stable: + // + // `async fn init_sqlite()`: before using C-API, you must initialize sqlite, once. + // + // `fn sqlite()`: get the sqlite instance // - // Initializing the database is a one-time operation during - // the life of the program. + // `SQLiteError`: initializing instance and other possible errors #[cfg(feature = "sqlite")] #[cfg(all(target_family = "wasm", target_os = "unknown"))] - pub use sqlite_wasm_rs::init_sqlite; + pub use sqlite_wasm_rs::{init_sqlite, sqlite, SQLiteError}; } #[doc(inline)] diff --git a/diesel_compile_tests/Cargo.lock b/diesel_compile_tests/Cargo.lock index 0755f6642141..fe6a7c3537f5 100644 --- a/diesel_compile_tests/Cargo.lock +++ b/diesel_compile_tests/Cargo.lock @@ -809,9 +809,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "sqlite-wasm-rs" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "087e83af73ac1ca6f08a8b422aed7aab6a72df4801da5ee6f6f59b6b9a70f7d5" +checksum = "3080f6ef7066796839acf1ca63f8fc487e87722e601226cab8e465e94efe9abc" dependencies = [ "fragile", "js-sys",