[−][src]Function varlink_generator::cargo_build_tosource
pub fn cargo_build_tosource<T: AsRef<Path> + ?Sized>(
input_path: &T,
rustfmt: bool
)
cargo build helper function
cargo_build_tosource
is used in a build.rs
program to build the rust
code from a varlink interface definition. This function saves the rust code
in the same directory as the varlink file. The name is the name of the
varlink file and "." replaced with "_" and of course ending with ".rs".
Use this, if you are using an IDE with code completion, as most cannot cope
with include!(concat!(env!("OUT_DIR"), "<varlink_file>"));
Set rustfmt
to true
, if you want the generator to run rustfmt on the
generated code. This might be good practice to avoid large changes after a
global cargo fmt
run.
Errors are emitted to stderr and terminate the process.
Examples
extern crate varlink_generator; fn main() { varlink_generator::cargo_build_tosource("src/org.example.ping.varlink", true); }