| Crates.io | tb-rs |
| lib.rs | tb-rs |
| version | 0.16.0+0.1.0 |
| created_at | 2026-01-06 13:48:25.529129+00 |
| updated_at | 2026-01-06 13:48:25.529129+00 |
| description | Native Rust client for TigerBeetle (compatible with TB 0.16.x) |
| homepage | |
| repository | https://github.com/dsp/tb |
| max_upload_size | |
| id | 2025892 |
| size | 136,277 |
Native Rust client for TigerBeetle, the financial transactions database.
This client is compatible with TigerBeetle 0.16.x.
TigerBeetle requires exact client-server protocol compatibility. This crate's version
follows the format TB_VERSION+CRATE_VERSION (e.g., 0.16.0+0.1.0), where:
0.16.0) indicates TigerBeetle server compatibility+0.1.0) indicates the library versionYou can check compatibility at runtime:
println!("TigerBeetle version: {}", tb_rs::TIGERBEETLE_VERSION);
println!("Library version: {}", tb_rs::CRATE_VERSION);
Client type with a clean builder patternAdd to your Cargo.toml:
[dependencies]
tb-rs = "0.16" # Compatible with TigerBeetle 0.16.x
Note: The version "0.16" matches all 0.16.x+* versions. Cargo ignores build metadata for dependency resolution.
use tb_rs::{Client, Account, AccountFlags};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Must run inside tokio_uring runtime
tokio_uring::start(async {
// Connect to cluster
let mut client = Client::connect(0, "127.0.0.1:3000").await?;
// Create an account
let account = Account {
id: tb_rs::id(),
ledger: 1,
code: 1,
..Default::default()
};
let errors = client.create_accounts(&[account]).await?;
assert!(errors.is_empty(), "Account creation failed");
// Lookup the account
let accounts = client.lookup_accounts(&[account.id]).await?;
println!("Found {} accounts", accounts.len());
client.close().await;
Ok(())
})
}
Use the builder pattern for custom configuration:
use std::time::Duration;
use tb_rs::Client;
let client = Client::builder()
.cluster(0)
.addresses("127.0.0.1:3000,127.0.0.1:3001")?
.connect_timeout(Duration::from_secs(10))
.request_timeout(Duration::from_millis(100))
.build()
.await?;
create_accounts(&[Account]) - Create accounts, returns errors for failureslookup_accounts(&[u128]) - Lookup accounts by IDquery_accounts(QueryFilter) - Query accounts with filtersget_account_balances(AccountFilter) - Get balance historycreate_transfers(&[Transfer]) - Create transfers, returns errors for failureslookup_transfers(&[u128]) - Lookup transfers by IDquery_transfers(QueryFilter) - Query transfers with filtersget_account_transfers(AccountFilter) - Get transfers for an accountThe Client is !Send because io_uring submission queues are thread-local.
Create one client per thread if you need multi-threaded access.
Apache-2.0