Crate weld_codegen

source ·

Modules

Macros

Structs

  • A cheaply cloneable and sliceable chunk of contiguous memory.
  • A Generator is a data-driven wrapper around code generator implementations, There are two main modes of generation: handlebars template-driven, and code-driven. For the latter, you implement a trait CodeGen, which gets callbacks for various parts of the code generation. One parameter to CodeGen is the output file name, which can be used if code is to be generated across several files. (for example, if you want one file to define interfaces and a separate file to define implementation classe). Handlebars-driven code generation may be more well-suited for files such as Makefiles and project config files that don’t need a huge amount of customization, but they can also be used to generate 100% of an interface. You decide!

Functions

  • wraps the logic inside build.rs
  • Generate rust code using the codegen.toml config file and output directory. config_path should be relative to the directory containing build.rs (or absolute). output_relative_dir, the location of generated files, should either be an absolute path, or a path relative to the folder containing the codegen.toml file. To use rustc’s build folder, from inside build.rs, use &std::env::var("OUT_DIR").unwrap()
  • Load all model sources and merge into single model.
  • Add all templates from the specified folder, using the base file name as the template name. For example, “header.hbs” will be registered as “header”