turso crate provides an async Rust API for embedding Turso in your application.
Installation
Add the dependency toCargo.toml:
Async runtime
Allturso APIs are async. The crate is runtime-agnostic but is tested primarily with Tokio. Any async executor that supports Future + Send should work.
Quick start
API flow
Optional builder features
TheBuilder exposes feature flags for experimental capabilities:
| Method | Description |
|---|---|
.experimental_encryption(bool) | Enable at-rest encryption |
.with_encryption(EncryptionOpts) | Supply encryption key and cipher |
.experimental_attach(bool) | Enable ATTACH DATABASE |
.experimental_custom_types(bool) | Enable custom column types |
.experimental_index_method(bool) | Enable custom index methods |
.experimental_materialized_views(bool) | Enable materialized views |
.with_io(vfs) | Override the I/O backend |
Exports
| Item | Kind | Description |
|---|---|---|
Builder | struct | Constructs a Database |
Database | struct | Points to a database file |
Connection | struct | An open connection |
Statement | struct | A compiled statement |
Rows | struct | Query result set |
Row | struct | A single result row |
Value | enum | SQL value (Null, Integer, Real, Text, Blob) |
Error | enum | All error variants |
Result<T> | type alias | std::result::Result<T, Error> |
IntoParams | trait | Convert Rust values into bind parameters |
Pages in this section
Builder
Construct a Database from a path or memory.
Connection
Execute queries and manage transactions.
Statement
Compiled statement, row iteration, and column access.