1 unstable release
Uses new Rust 2024
| 0.1.0 | Jul 13, 2025 |
|---|
#4 in #skilltree
Used in capability
56KB
804 lines
Grower Skill Tree Crate Writer
Grower Skill Tree Crate Writer is a Rust crate that provides a flexible interface for generating skill trees in the form of Rust code. This facility is particularly useful for applications requiring hierarchical data structures, such as game development, simulations, and various modeling tasks.
Overview
This crate defines the SkillTreeCrateWriter trait, which allows the implementation of components capable of outputting Rust crate text that represents different node types: dispatch, aggregate, and leaf holder nodes.
Key Features
- Dispatch Nodes: These are modeled as enums that select one of several child nodes, each represented as a variant.
- Aggregate Nodes: Represented as structs, each with fields corresponding to child nodes. Optional fields are wrapped in
Optiontypes, and children probabilities are annotated for construction logic. - Leaf Holder Nodes: Enums with variants for each leaf, allowing descriptor annotation via an AI-inspired attribute.
Error Handling
The crate provides a simple error representation via the GrowerModelWriteSkillTreeError enum, facilitating straightforward error management within skill tree generation processes.
Usage Example
Here's a simple example demonstrating how to use the SkillTreeCrateWriter trait:
use capability_crate_writer::{SkillTreeCrateWriter, GrowerModel, GrowerModelWriteSkillTreeError};
impl SkillTreeCrateWriter for GrowerModel {
type Error = GrowerModelWriteSkillTreeError;
fn skill_tree_write_crate_text(&self) -> Result<String, Self::Error> {
// Implementation goes here.
}
}
Getting Started
Add the following to your Cargo.toml:
[dependencies]
capability-crate-writer = "0.1.0"
Contributing
Contributions are welcome. Please follow the standard Rust guidelines for greater consistency and quality.
License
This project is licensed under the terms of the GPL-3.0 license.
This README.md file was generated by an AI model and may not be 100% accurate, however it should be pretty good.
Dependencies
~49–92MB
~1.5M SLoC