lume_architect

Crates.iolume_architect
lib.rslume_architect
version0.0.1
created_at2025-10-18 19:43:27.021563+00
updated_at2025-10-18 19:43:27.021563+00
descriptionLibrary for creating memoized queries, in a simple way
homepage
repositoryhttps://github.com/lume-lang/architect
max_upload_size
id1889570
size22,792
Max T. Kristiansen (maxnatamo)

documentation

README

Lume Architect

CI crates.io docs.rs

A simplistic query system, allowing for on-demand, memoized computation.

architect is a way of defining queries. A query is some function which takes a set of arguments and computes some result. By default, results from queries are memoized to prevent recomputation. This does assume that the result of the query is idempotent, given the input arguments.

Getting started

To make a function into a query, add the crate:

cargo add lume_architect --features derive

On the type which the query operates on, implement the DatabaseContext trait:

use lume_architect::{Database, DatabaseContext};

struct Provider {
    // ... other fields

    db: Database,
}

impl DatabaseContext for Provider {
    fn db(&self) -> &Database {
        &self.db
    }
}

To declare a method as a query, add the cached_query attribute:

impl Provider {
    /// Computes some result, which takes a reeeeally long time.
    #[cached_query]
    pub fn compute(&self) -> f32 {
        // ...
    }
}

Inspiration

This implementation is heavily based on Rust's query system, based on salsa. Massive credit to the countless of amazing developers who helped create them.

Commit count: 0

cargo fmt