Documentation navigation
Anybuild documentation

Rust SDK

Use the same detection and orchestration pipeline without spawning the CLI.

Project facade

Rust
use anybuild::{Anybuild, BuildOptions, RunOptions};
let project = Anybuild::new(".")    .with_subdir("apps/web")    .with_env("ANYBUILD_NODE_VERSION", "22");
let plan = project.plan(Default::default())?;let build = project.build(BuildOptions::default())?;let run = project.run(RunOptions::default().start())?;
# Ok::<(), anybuild::Error>(())

Operations and outcomes

MethodOutcome
generateGeneratedAnybuild: path, content, provider, effective config.
planProjectPlan: provider, config, services, evaluated Serve.
buildBuildOutcome: plan and state directory.
runRunOutcome: executed and skipped command names.
deployDeployOutcome: published identity or written config path.
autoAutoOutcome combining optional generation, build, run, and deploy.

Typed execution options

TypeChoices
BuildEnvironmentLocal or Docker(DockerOptions).
RuntimeEnvironmentLocal or Wasmer(WasmerOptions).
GenerationPolicyIfMissing, Always, or Temporary.
DeployTargetPublish { owner, name } or WriteConfig { path }.
ProcessIoInherit subprocess streams or emit them as Events.

Environment isolation

Anybuild::new snapshots the process environment. Per-instance with_env values override that snapshot, and inherit_process_env(false) creates a deterministic empty base environment without mutating global process state.

Events and process I/O

The SDK is silent for Anybuild-generated output until an EventHandler is installed. ProcessIo::Inherit keeps subprocesses interactive; ProcessIo::Events captures stdout and stderr as redacted structured events.

Errors

anybuild::Error exposes an ErrorKind, operation name, project path, and underlying source. Error kinds are non-exhaustive so callers can handle broad categories safely.