query-flow 0.7.0

A high-level query framework built on whale for incremental computation.
Documentation

Query-Flow: A high-level query framework for incremental computation.

Built on top of [whale], this crate provides a user-friendly API for defining and executing queries with automatic caching and dependency tracking.

Key Features

  • Async-agnostic queries: Write sync query logic, run with sync or async runtime
  • Automatic caching: Query results are cached and invalidated based on dependencies
  • Suspense pattern: Handle async loading with AssetLoadingState without coloring functions
  • Type-safe: Per-query-type caching with compile-time guarantees
  • Early cutoff: Skip downstream recomputation when values don't change

Example

use query_flow::{query, QueryContext, QueryError, QueryRuntime};

#[query]
fn add(ctx: &mut QueryContext, a: i32, b: i32) -> Result<i32, QueryError> {
    Ok(a + b)
}

let runtime = QueryRuntime::new();
let result = runtime.query(Add::new(1, 2)).unwrap();
assert_eq!(*result, 3);