2 releases (1 stable)
Uses new Rust 2024
| 1.0.0 | Mar 5, 2026 |
|---|---|
| 0.1.0 | Dec 12, 2025 |
#735 in Caching
23 downloads per month
220KB
4.5K
SLoC
picante
Async incremental query runtime for Rust.
Picante is inspired by Salsa, but built for Tokio-first pipelines. It provides:
- inputs
- interning
- async derived queries
- dependency tracking
- cache persistence with
facetandfacet-postcard - debugging and observability tools
See the repository README and the crate docs for examples and usage details.
lib.rs:
Picante is an async incremental query runtime, inspired by Salsa but designed for Tokio-first pipelines.
Picante provides:
- Inputs via
InputIngredient - Async derived queries via
DerivedIngredient - Dependency tracking via Tokio task-local frames
- Snapshot persistence via
persist(usingfacet+facet-postcard, no serde)
Minimal example
use picante::{DerivedIngredient, DynIngredient, HasRuntime, IngredientLookup, IngredientRegistry, InputIngredient, QueryKindId, Runtime};
use std::sync::Arc;
#[derive(Default)]
struct Db {
runtime: Runtime,
ingredients: IngredientRegistry<Db>,
}
impl HasRuntime for Db {
fn runtime(&self) -> &Runtime {
&self.runtime
}
}
impl IngredientLookup for Db {
fn ingredient(&self, kind: QueryKindId) -> Option<&dyn DynIngredient<Self>> {
self.ingredients.ingredient(kind)
}
}
let db = Db::default();
let text: Arc<InputIngredient<String, String>> =
Arc::new(InputIngredient::new(QueryKindId(1), "Text"));
let len: Arc<DerivedIngredient<Db, String, u64>> = {
let text = text.clone();
Arc::new(DerivedIngredient::new(QueryKindId(2), "Len", move |db, key| {
let text = text.clone();
Box::pin(async move {
let s = text.get(db, &key)?.unwrap_or_default();
Ok(s.len() as u64)
})
}))
};
text.set(&db, "a".into(), "hello".into());
assert_eq!(len.get(&db, "a".into()).await?, 5);
Dependencies
~16–31MB
~357K SLoC