pub struct JuteGenerator {
pub out_dir: Option<PathBuf>,
pub src_files: Vec<PathBuf>,
}Expand description
High-level Jute code generation driver.
JuteGenerator follows a builder-style API and is responsible for:
- Collecting source
.jutefiles - Parsing them into ASTs
- Resolving type and module dependencies
- Invoking the language-specific code generator (Rust)
§Example
use jute::JuteGenerator;
let schema_path1 = "./schema/1.jute";
let schema_path2 = "./schema/2.jute";
let out_dir_path= "generated";
JuteGenerator::new()
.add_src_file(schema_path1)
.add_src_file(schema_path2)
.add_out_dir(out_dir_path)
.generate()
.unwrap();Fields§
§out_dir: Option<PathBuf>Output directory where generated code will be written.
If not provided, code generation defaults to the current(src) directory.
src_files: Vec<PathBuf>List of input Jute schema files.
Implementations§
Source§impl JuteGenerator
impl JuteGenerator
Sourcepub fn add_src_file<P: AsRef<Path>>(self, file_path: P) -> Self
pub fn add_src_file<P: AsRef<Path>>(self, file_path: P) -> Self
Sourcepub fn add_out_dir<P: AsRef<Path>>(self, out_dir: P) -> Self
pub fn add_out_dir<P: AsRef<Path>>(self, out_dir: P) -> Self
Sets the output directory for generated code.
§Panics
Panics if the output directory is already set.
Sourcepub fn generate(self) -> Result<(), JuteError>
pub fn generate(self) -> Result<(), JuteError>
Executes the full code generation pipeline.
This method:
- Parses all provided
.jutefiles into AST documents - Resolves cross-module and cross-file dependencies
- Merges all modules into a single collection
- Generates Rust code into the configured output directory
§Errors
Returns an error if:
- Parsing fails
- Dependency resolution fails
- Code generation fails
Trait Implementations§
Source§impl Default for JuteGenerator
impl Default for JuteGenerator
Source§fn default() -> JuteGenerator
fn default() -> JuteGenerator
Returns the “default value” for a type. Read more