rust
experimentalCompiled Rust functions, copied records, native callbacks and Cargo dependencies.
use plugin rust Plugin snippets can be edited in the Playground, but native capabilities are executed locally with the Zolo CLI.
From import to result
- 01Import only what you use
- 02Copy the smallest example
- 03Run it with the Zolo CLI
Functions¶
| Provider | Description |
|---|---|
rust |
Rust functions, async, expressions and .rs imports |
Use typed Zolo signatures with Rust bodies, then call the compiled functions directly.
use plugin rust::{rust}
extern rust fn upper(value: str) -> str { value.to_uppercase() }
extern rust async fn later(value: int) -> int { async { value + 1 }.await }
print(upper("Zolo"))
print(await later(41))int maps to i64, str to String, bytes to Vec<u8>, arrays to Vec<T> and
nullable values to Option<T>. Public structs and string-keyed maps are copied
data. Retained native objects, receiver methods, unsafe/generic/variadic exports
need a concrete typed free-function adapter.
Callbacks are call-scoped Rust closures, support nested Zolo calls and must not escape or run on an unrelated native thread. Async functions use genuine Rust futures and a small standard-library executor; executor-specific libraries such as Tokio need an explicit wrapper. Cancellation closes callback/result delivery. Unwinding panics and Result errors include authored source information; panic=abort and native crashes retain native process behavior.
Global extern rust deps and [foreign.rust.dependencies] select Cargo
versions, features and default_features. Installation resolves and vendors an
isolated closure. Compilation uses its exact Cargo.lock offline. Editor analysis
keeps native build scripts/proc macros disabled; explicit compilation can run
those deliberately selected dependency build steps.
Preparation needs rustc or Cargo, selected by ZOLO_RUSTC/ZOLO_CARGO.
Native editor queries use ZOLO_RUST_ANALYZER and preserve current unsaved
source without loading authored code. VM/native/LLVM dynamic/embed/static
artifacts run in process without source files, Rust or a package cache.
Windows x64 is verified; other hosts require independent acceptance. Hosted wasm-aot execution is unavailable. See Rust examples and dependency policies.