deps-gen
From Cargo.lock
to a generated file.
Why?
The goal is to generate a file from a template with dependencies from Cargo.lock
.
How?
Build
In Cargo.toml
, add the following line:
[]
= "*"
then in your build.rs
:
use deps_gen;
The default configuration will take a src/deps.template.rs
file and generate a src/deps.rs
.
Templating
The library uses handlebars with the default supported syntax. The supported field are
dependencies
, an array with the following valuesname
version
authors
id
source
description
dependencies
license
license_file
targets
features
manifest_path
categories
keywords
readme
repository
homepage
documentation
edition
see Rust manifest reference for fields details
Also note that //{}
is replaced with
(an empty string) after template processing. This allows to cleanup.
An example
deps.template.rs
: