inherit-core
Core library for
cargo-inherit.
The engine behind cargo-inherit: template loading, variable resolution, and project generation.
Use this crate to embed Inherit's templating logic into your own tools.
Features
- Manifest-driven:
Inherit.tomldeclares template metadata, variables, and hooks - Variable collection: Automatically scans template files for
@VAR@placeholders - Git-aware ignoring:
.inherignoresupport using gitignore-compatible syntax - Safe generation: Atomic file operations, validation, and clear error reporting
- Hook system: Run post-creation commands in the generated project
Quick Start
Add to your dependencies:
Basic usage:
use ;
use Path;
// Load template context (manifest + scanned variables)
let ctx = load_template?;
// Prepare variable values (e.g., from user input or config)
let mut vars = new;
vars.insert;
// ... fill all required variables ...
// Generate the project
let result = process_template?;
println!;
Documentation
Full API reference, Inherit.toml specification, and integration guides are available in the book.
License
MIT OR Apache-2.0