graphiti

Crates.iographiti
lib.rsgraphiti
version0.1.2
sourcesrc
created_at2023-10-15 21:46:02.546183
updated_at2023-10-16 00:13:12.075137
descriptiongraphiti provides a rust macro dsl and builder for creating and describing arbitrary sets of related data using a serializable description type.
homepagehttps://github.com/matthewjberger/graphiti
repositoryhttps://github.com/matthewjberger/graphiti
max_upload_size
id1004124
size26,989
Matthew J. Berger (matthewjberger)

documentation

README

graphiti

github crates.io docs.rs

graphiti provides a rust macro dsl and builder for creating and describing arbitrary sets of related data, represented by a Description type.

A common use case is for modeling physical simulations, where you would want to leverage an entity component system but want the benefits of describing relationships between simulation members using directed graphs.

With graphiti, simulations can be described using a type-safe rust macro dsl that drives a builder pattern constructing a final Description type. With this Description, the data is organized and easily accessible for business logic that may want to use the stored data. This could be for a game (ECS + Scenegraphs), hardware simulations, etc.

Usage

Add this to your Cargo.toml:

graphiti = "0.1.2"

Example:

fn main() {
    let description = graphiti::describe! {
        nodes: {
            device: "device",
            safety: "safety",
            controller: "controller",
            power: "power",
            control: "control",
            io: "io"
        },
        edges: {
            "config_standard": {
                device: [safety, controller, power, control, io],
                safety: [controller, power]
            },
            "config_alternate": {
                device: [controller, control, io],
                controller: [power]
            }
        }
    };
    println!("{description:#?}");
}
Commit count: 6

cargo fmt