1 unstable release
Uses new Rust 2024
| 0.1.0 | Jul 13, 2025 |
|---|
Used in 4 crates
(3 directly)
47KB
177 lines
capability-generation-inputs
capability-generation-inputs is a Rust crate designed to manage and validate the input parameters crucial for configuring and shaping tree-based model generation in adaptable environments. This crate serves as a foundation for more complex systems exploring context-driven growth models, where the inputs shape tree parameters or regenerate models in dynamic contexts.
Key Features
-
Structured Input Representation: Utilizes
GrowerInputsstruct to encapsulate essential environment context details, including global descriptors, targets, neighboring entities, and various sub-environments. -
Robust Validation: Provides validation methods to ensure integrity and completeness of input data, raising specific errors like
EmptyEnvironmentDescriptionandEmptyCrateNamewhen constraints are violated. -
Serialization and Deserialization: Supports conversion between
GrowerInputsstructures and TOML strings or files, facilitating easy configuration management. -
Error Handling: Defines the
GrowerInputErrorenumeration to handle a range of potential issues, from IO errors to specific TOML serialization/deserialization errors.
Usage
use capability_generation_inputs::GrowerInputs;
let input_str = r#"
global_environment_descriptor = "Arboreal Dynamics"
target = "growth_model"
neighbors = ["neighbor1", "neighbor2"]
sub_environments = ["sub1", "sub2"]
"#;
let inputs = GrowerInputs::from_toml_str(input_str).expect("Failed to parse inputs");
assert!(inputs.validate().is_ok());
let output_filename = inputs.output_file_name(); // Will produce "growth_model.json"
println!("Generated output filename: {}", output_filename);
Error Types
The crate makes use of a comprehensive error handling strategy via GrowerInputError, covering common load and parse issues to ensure resilient applications. Notable errors include:
TomlSerErrorandTomlDeErrorfor TOML serialization/deserialization failures.Iofor input/output operations related issues.
Related Crates
derive_builder: Used for building flexible input structures.getset: Implements property-like accessors for input fields.
DISCLAIMER
This README.md was generated by an AI model and may not be 100% accurate but should be reasonably reliable for understanding and using this crate.
For detailed API documentation and more nuanced examples, please refer to the project's documentation or contact the maintainer.
Dependencies
~48–91MB
~1.5M SLoC