choice-engine (0.2.0)

Published 2026-09-13 23:16:08 +02:00 by sam in sam/choice-engine

Installation

[registries.forgejo]
index = "sparse+" # Sparse index
# index = "" # Git

[net]
git-fetch-with-cli = true
cargo add choice-engine@0.2.0 --registry forgejo

About 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
Cargo
2026-09-13 23:16:08 +02:00
1
8.5 KiB
Assets (1)
Versions (2) View all
0.2.0 2026-09-13
0.1.0 2026-08-23