Skip to content

Commit 30d4098

Browse files
authored
Update documentation (#115)
1 parent bd29680 commit 30d4098

4 files changed

Lines changed: 20 additions & 30 deletions

File tree

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# SQLite Wasm Rust
2-
31
[![Crates.io](https://img.shields.io/crates/v/sqlite-wasm-rs.svg)](https://crates.io/crates/sqlite-wasm-rs)
42

53
Provide sqlite solution for `wasm32-unknown-unknown` target.
@@ -93,11 +91,11 @@ Here is an example showing how to use `sqlite-wasm-rs` to implement a simple in-
9391
This library is not thread-safe:
9492

9593
* `JsValue` is not cross-threaded, see <https://github.com/rustwasm/wasm-bindgen/pull/955> for details.
96-
* sqlite is compiled with `-DSQLITE_THREADSAFE=0`
94+
* sqlite is compiled with `-DSQLITE_THREADSAFE=0`.
9795

9896
## Precompiled libsqlite3.a
9997

100-
Since `wasm32-unknown-unknown` does not have sysroot, emscripten is used here for compilation, otherwise we need to copy a bunch of c headers required for sqlite3 compilation. If sqlite3 is compiled at compile time, the emscripten toolchain is required, and we cannot assume that all users have it installed. (Believe me, because rust mainly supports the `wasm32-unknown-unknown` target, most people do not have the emscripten toolchain). Considering that wasm is cross-platform, vendor compilation products are acceptable.
98+
Since `wasm32-unknown-unknown` does not have sysroot, emscripten is used here for compilation, otherwise we need to copy a bunch of c headers required for sqlite3 compilation. If bundled feature is enabled, the emscripten toolchain is required, and we cannot assume that all users have it installed. (Believe me, because rust mainly supports the `wasm32-unknown-unknown` target, most people do not have the emscripten toolchain). Considering that wasm is cross-platform, vendor compilation products are acceptable.
10199

102100
About security:
103101

@@ -127,11 +125,6 @@ export CFLAGS_wasm32_unknown_emscripten="-mno-reference-types"
127125

128126
used to disable `reference-types` of the C library.
129127

130-
## Nice Try
131-
132-
* [`diesel`](https://github.com/diesel-rs/diesel): A safe, extensible ORM and Query Builder for Rust.
133-
* [`sqlight`](https://github.com/Spxg/sqlight): A SQLite Playground that runs completely locally.
134-
135128
## Related Project
136129

137130
* [`diesel`](https://github.com/diesel-rs/diesel): A safe, extensible ORM and Query Builder for Rust.

src/vfs/memory.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub enum MemVfsError {
160160
Generic(String),
161161
}
162162

163-
/// MemVfs management tools exposed to clients.
163+
/// MemVfs management tool.
164164
pub struct MemVfsUtil(&'static VfsAppData<MemAppData>);
165165

166166
unsafe impl Send for MemVfsUtil {}
@@ -244,12 +244,12 @@ impl MemVfsUtil {
244244
}
245245
}
246246

247-
/// Delete the specified database, please make sure that the database is closed.
247+
/// Delete the specified database, make sure that the database is closed.
248248
pub fn delete_db(&self, filename: &str) {
249249
self.0.borrow_mut().remove(filename);
250250
}
251251

252-
/// Delete all database, please make sure that all database is closed.
252+
/// Delete all database, make sure that all database is closed.
253253
pub fn clear_all(&self) {
254254
std::mem::take(&mut *self.0.borrow_mut());
255255
}

src/vfs/relaxed_idb.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ impl RelaxedIdbCfgBuilder {
796796
self
797797
}
798798

799-
/// Build `RelaxedIdbCfg`
799+
/// Build `RelaxedIdbCfg`.
800800
pub fn build(self) -> RelaxedIdbCfg {
801801
self.0
802802
}
@@ -828,7 +828,7 @@ impl Default for RelaxedIdbCfg {
828828
}
829829
}
830830

831-
/// RelaxedIdb management tools exposed to clients.
831+
/// RelaxedIdbVfs management tool.
832832
pub struct RelaxedIdbUtil {
833833
pool: &'static VfsAppData<RelaxedIdb>,
834834
}
@@ -873,12 +873,12 @@ impl RelaxedIdbUtil {
873873
self.pool.export_db(filename)
874874
}
875875

876-
/// Delete the specified database, please make sure that the database is closed.
876+
/// Delete the specified database, make sure that the database is closed.
877877
pub fn delete_db(&self, filename: &str) -> Result<WaitCommit> {
878878
self.pool.delete_db(filename)
879879
}
880880

881-
/// Delete all database, please make sure that all database is closed.
881+
/// Delete all database, make sure that all database is closed.
882882
pub fn clear_all(&self) -> Result<WaitCommit> {
883883
self.pool.clear_all()
884884
}
@@ -899,11 +899,11 @@ impl RelaxedIdbUtil {
899899
}
900900
}
901901

902-
/// Register `relaxed-idb` vfs and return a utility object which can be used
903-
/// to perform basic administration of the file pool
902+
/// Register `relaxed-idb` vfs and return a management tool which can be used
903+
/// to perform basic administration of the file pool.
904904
///
905905
/// If the vfs corresponding to `options.vfs_name` has been registered,
906-
/// only return a utility object.
906+
/// only return a management tool without register.
907907
pub async fn install(options: &RelaxedIdbCfg, default_vfs: bool) -> Result<RelaxedIdbUtil> {
908908
static REGISTER_GUARD: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
909909
let _guard = REGISTER_GUARD.lock().await;

src/vfs/sahpool.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ impl OpfsSAHPoolCfgBuilder {
620620
self
621621
}
622622

623-
/// Build OpfsSAHPoolCfg
623+
/// Build `OpfsSAHPoolCfg`.
624624
pub fn build(self) -> OpfsSAHPoolCfg {
625625
self.0
626626
}
@@ -636,7 +636,7 @@ impl Default for OpfsSAHPoolCfgBuilder {
636636
pub struct OpfsSAHPoolCfg {
637637
/// The SQLite VFS name under which this pool's VFS is registered.
638638
pub vfs_name: String,
639-
/// Specifies the OPFS directory name in which to store metadata for the `vfs_name`
639+
/// Specifies the OPFS directory name in which to store metadata for the `vfs_name`.
640640
pub directory: String,
641641
/// If truthy, contents and filename mapping are removed from each SAH
642642
/// as it is acquired during initalization of the VFS, leaving the VFS's
@@ -701,10 +701,7 @@ impl OpfsSAHError {
701701
}
702702
}
703703

704-
/// A OpfsSAHPoolUtil instance is exposed to clients in order to
705-
/// manipulate an OpfsSAHPool object without directly exposing that
706-
/// object and allowing for some semantic changes compared to that
707-
/// class.
704+
/// SAHPoolVfs management tool.
708705
pub struct OpfsSAHPoolUtil {
709706
pool: &'static VfsAppData<SyncAccessHandleAppData>,
710707
}
@@ -760,12 +757,12 @@ impl OpfsSAHPoolUtil {
760757
self.pool.export_db(filename)
761758
}
762759

763-
/// Delete the specified database, please make sure that the database is closed.
760+
/// Delete the specified database, make sure that the database is closed.
764761
pub fn delete_db(&self, filename: &str) -> Result<bool> {
765762
self.pool.delete_file(filename)
766763
}
767764

768-
/// Delete all database, please make sure that all database is closed.
765+
/// Delete all database, make sure that all database is closed.
769766
pub async fn clear_all(&self) -> Result<()> {
770767
self.pool.release_access_handles();
771768
self.pool.acquire_access_handles(true).await?;
@@ -788,11 +785,11 @@ impl OpfsSAHPoolUtil {
788785
}
789786
}
790787

791-
/// Register `opfs-sahpool` vfs and return a utility object which can be used
792-
/// to perform basic administration of the file pool
788+
/// Register `opfs-sahpool` vfs and return a management tool which can be used
789+
/// to perform basic administration of the file pool.
793790
///
794791
/// If the vfs corresponding to `options.vfs_name` has been registered,
795-
/// only return a utility object.
792+
/// only return a management tool without register.
796793
pub async fn install(options: &OpfsSAHPoolCfg, default_vfs: bool) -> Result<OpfsSAHPoolUtil> {
797794
static REGISTER_GUARD: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
798795
let _guard = REGISTER_GUARD.lock().await;

0 commit comments

Comments
 (0)