Expand description
§deps-gen
Allows to generate files from Cargo.lock
and a provided template at build-time
§Example
The following will build a file named src/deps.rs
.
In Cargo.toml
, add the following line:
[build-dependencies]
deps-gen = "*"
then in your build.rs
:
use deps_gen::gen_deps;
fn main() {
gen_deps();
}
Add src/deps.template.rs
:
#[allow(dead_code)]
pub struct License {
pub name: &'static str,
pub version: &'static str,
}
impl License {
pub fn all() -> Vec<Self> {
vec![
//{}{{#each dependencies}}
Self {
name: "{{name}}",
version: "{{version}}",
},
//{}{{/each}}
]
}
}
See readme for more details
Structs§
- Configuration
Configuration
struct
Enums§
Functions§
- gen_
deps - For lazy people (like me 😉) the default configuration will take
src/deps.template.rs
to generatesrc/deps.rs
- gen_
deps_ with_ conf - Detailed generator, allowing to customize configuration