Rust
Prerequisites
Section titled “Prerequisites”A stable Rust toolchain supporting edition 2021. Native capabilities build through Cargo and use the maintained dependencies required by the output.
Compile and run
Section titled “Compile and run”From a prepared source module containing a main package:
goalchemy compile -target rust -out out/rust .cd out/rustsh run.shOr use goalchemy run -target rust . to compile and execute in a temporary directory. Add -gate cooperative for source tasks or suspending operations.
Generated output
Section titled “Generated output”The Rust target emits src/main.rs for executables, package-owned src/pkg_*.rs modules, src/shared.rs, selected src/rt/ files, Cargo.toml, and run.sh. Standard-only output can run through plain rustc; capability output uses Cargo.
Every output includes its own README.md, selected runtime files, source mappings, and goalchemy.manifest.json. See the full output reference for the inventory and entry behavior.
Native libraries
Section titled “Native libraries”Non-main packages emit src/lib.rs and an owned Cargo library boundary with Result/Future APIs and cancellation. Your SDK delivery pipeline supplies its dependency lock. Read the Rust library boundary for values, host entry, and lifecycle.
Runtime and diagnostics
Section titled “Runtime and diagnostics”Values live in a traced heap collected at safepoints; byte leaves use native Vec<u8>. Set GOALCHEMY_HEAP_STATS=1 to print heap statistics and GOALCHEMY_GC_THRESHOLD to control collection frequency. .rs.lines sidecars retain source positions.