Crates.io | graphiti |
lib.rs | graphiti |
version | 0.1.2 |
source | src |
created_at | 2023-10-15 21:46:02.546183 |
updated_at | 2023-10-16 00:13:12.075137 |
description | graphiti provides a rust macro dsl and builder for creating and describing arbitrary sets of related data using a serializable description type. |
homepage | https://github.com/matthewjberger/graphiti |
repository | https://github.com/matthewjberger/graphiti |
max_upload_size | |
id | 1004124 |
size | 26,989 |
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.
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:#?}");
}