pub fn compile_to_dir(
source: &str,
output_dir: &Path,
) -> Result<(), CompileError>Expand description
Compile LOGOS source and write output to a directory as a Cargo project.
Creates a complete Cargo project structure with:
src/main.rscontaining the generated Rust codeCargo.tomlwith runtime dependenciescrates/directory with runtime crate copies
§Arguments
source- LOGOS source code as a stringoutput_dir- Directory to create the Cargo project in
§Errors
Returns CompileError if:
- Compilation fails (wrapped as
CompileError::Parse) - File system operations fail (wrapped as
CompileError::Io)
§Example
let source = "## Main\nShow \"Hello\".";
compile_to_dir(source, Path::new("/tmp/my_project"))?;
// Now /tmp/my_project is a buildable Cargo project