Generic implementation of backtracking together with some examples. This came out of a code dojo session with some of my colleagues (https://github.com/pacman82/cobra-kai-code-dojo). I found it neat enough to put it into its own repository.
This fork adds test coverage (the library and all five examples now have unit tests; CI runs
cargo test --all-targets against both the default and parallel feature sets) and two
backward-compatible extensions to the Problem/Solutions API:
Problem::Possibilitynow requires onlyClone, notCopy. EveryCopytype is alreadyClone, so existing implementations are unaffected; the weaker bound additionally allows heap-backed decision types (an ownedString, aVec, ...) without forcing them through an artificial handle/index indirection just to satisfy the trait.- An opt-in, experimental
parallelfeature addsparallel_solutions. It searches the independent branches rooted at each top-level possibility in parallel (viarayon), with each branch still walked sequentially by an ordinarySolutionsiterator on its own thread. The extraClone + Send + Syncbounds only apply at that new call site —Solutions::newand its bounds are untouched, and therayondependency is not compiled unless the feature is enabled. Newer and less exercised than the core API; theword_chainexample (cargo run --example word_chain --release --features parallel) uses it to time a word-chain search sequentially and in parallel side by side. Its shape may still change in a minor version.