← All languages

wildling

Rust library and CLI for pattern-based string generation. Zero crates.io dependencies (Rust standard library only). Pattern splitting and JSON parsing are hand-rolled.

Example

Install

From this repository:

cd rust
./build.sh
./bin/wildling "Year 19##"

Git / path: Cargo does not allow git and path on the same dependency. Clone the tag (or add the monorepo as a git submodule) and depend on the rust/ crate path:

git clone --branch v2.0.7 --depth 1 https://github.com/dotmonk/wildling.git
# Cargo.toml in your app
wildling = { path = "../wildling/rust" }  # adjust relative path
cargo install --path path/to/wildling/rust   # CLI from that clone

Registry:

cargo add wildling          # library
cargo install wildling      # CLI
use wildling::{Dictionaries, Wildling};

let dicts = Dictionaries::new();
let mut w = Wildling::new(&["Year 19##".to_string()], &dicts);
while let Some(value) = w.next() {
    println!("{value}");
}

CLI

./bin/wildling "Year 19##"
./bin/wildling --dictionary planets:../dictionaries/planets.txt "%{'planets'}"
./bin/wildling --template ./config.json

Help text and --check output follow docs/cli.md / docs/help.txt.

Build

./build.sh   # Docker (rust:1.83): cargo build --release → dist/wildling

Project tests live in ../tests/ and are run with ../test.sh.