Rusqlite wraps SQLite’s C API for safe, convenient use from Rust. Optional Cargo features expose backups, extensions, hooks, limits, and serde-friendly types.
Overview
Rusqlite is a Rust crate that exposes SQLite connections, statements, transactions, and values with an ergonomic API. It evolved separately from rust-postgres and is the usual choice when Rust applications need embedded SQLite access without writing raw FFI calls.
The default build expects SQLite 3.45.3 or newer on the system, discovered through pkg-config or Vcpkg on MSVC builds. The bundled feature compiles a pinned SQLite version inside libsqlite3-sys; other features add SQLCipher linking, WASM builds via sqlite-wasm-rs, session support, and runtime bindgen when headers must be generated locally.
Optional integrations map Rust types from serde_json, chrono, time, jiff, and url into SQL parameters and columns. Additional flags enable loading dynamic SQLite extensions, online backup, custom SQL functions, tracing and profiling hooks, BLOB streaming as std::io traits, and per-connection limits.
Pregenerated bindgen output ships for supported SQLite versions so most users avoid a Clang dependency at compile time. Feature sets such as bundled-full exercise the widest API surface for contributors validating changes across configurations.
Key features
- Safe Rust wrapper over SQLite C API
- Transactions and prepared statements
- Optional bundled SQLite build
- SQLCipher and WASM build options
- Serde and chrono type mappings
- Backup and extension loading features
- Hooks for tracing and profiling
- BLOB access via std I/O traits
Use cases
- Embedded SQLite in Rust applications
- Offline local data storage
- Rust services needing SQL without a server
- WASM targets using sqlite-wasm-rs