Skip to main content

extract

Function extract 

Source
pub fn extract(rel_stencils_dir: &str) -> Result<(), Box<dyn Error>>
Expand description

Compiles and extracts stencils from a stencils crate

§Usage

Note that the current implementation hardcodes a lot of things:

  • The source directory of the stencils crate should be src/.
  • The internal .rlib format used by Rust is assumed to be located under some certain directories, named libXXX.rlib and is an object file.
  • The output directory of cargo rustc --release is assumed to be under $CARGO_TARGET_DIR/release/.

If things above are met, this function will probably work by compiling and extracting stencils into a $OUT_DIR/{}_stencils.rs file, where {} is the lowercase of the name specified in your setup_stencils!("..."); macro call in the stencils crate. For example, setup_stencils!("Calc"); will generate a file named calc_stencils.rs, which you may include with:

include!(concat!(env!("OUT_DIR"), "/calc_stencils.rs"));