I tried to use
cargo code generation as described cargo study code generation, it works in such case:
[package] name = "hello_world" build = "build.rs"
where build.rs contains:
let src = Path::new("src/main.rs.in"); let dst = Path::new(&env::var("OUT_DIR").unwrap()).join("main.rs"); registry.expand("hello_world", &src, &dst).unwrap();
all works fine, cargo found and compile generated
But when I try library instead of binary:
name = "hello_world"
build = “build.rs”
[lib] name = "test" crate-type = ["cdylib"]
why so and how can I fix this?