3 releases
0.1.2 | Oct 16, 2023 |
---|---|
0.1.1 | Oct 15, 2023 |
0.1.0 | Oct 15, 2023 |
#1626 in Data structures
10KB
166 lines
graphiti
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:#?}");
}
Dependencies
~6.5MB
~111K SLoC