choice-engine (0.2.0)
Installation
[registries.forgejo]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add choice-engine@0.2.0 --registry forgejoAbout this package
Choice Engine 2
Install
Set up repository
~/.cargo/config.toml:
[registries.sam_git]
index = "https://git.sam302.de/sam/_cargo-index.git"
[net]
git-fetch-with-cli = true
Install with Cargo
$ cargo add choice-engine --registry sam_git
Install manually
Cargo.toml:
[dependencies]
choice-engine = { version = "<VERSION>", registry = "sam_git" }
Quick start
use choice_engine::choice_engine;
use ::choice_engine::choice_engine::{StartupParameters, StateMachine};
fn main() {
// Startup parameters
let start_params: StartupParameters = StartupParameters {
file_location: String::from("dialog.toml"),
initial_timeline: 0
};
// Initialize a new state machine based on your start parameters.
let mut state_machine: StateMachine = choice_engine::init(&start_params).unwrap();
// This function returns the next dialog.
// Run this one time to begin and then every time the user makes a choice.
choice_engine::step(&mut state_machine);
}
Testing
| Description | Command |
|---|---|
| Run all tests without stdout when successful | cargo test |
| Run all tests with stdout | cargo test -- --no-capture |
| Print out timeline tree | cargo test read_and_parse_file -- --no-capture |
Dependencies
| ID | Version |
|---|---|
| bitflags | ^2.13.1 |
| toml | ^1.1.4 |
Details
Assets (1)
Versions (2)
View all
choice-engine-0.2.0.crate
8.5 KiB