Batamanta.RustTemplate (batamanta v1.5.0)

Copy Markdown View Source

Manages the Rust dispenser template and compilation.

Handles copying the template, injecting the compressed payload, and invoking Cargo to build the final binary.

  • Linux: x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu
  • Linux musl: x86_64-unknown-linux-musl, aarch64-unknown-linux-musl
  • macOS: x86_64-apple-darwin, aarch64-apple-darwin
  • Windows: x86_64-pc-windows-msvc (coming soon)

Summary

Functions

Injects the payload into the Rust template and builds the binary.

Initializes a temporary directory with the Rust dispenser template.

Functions

build(payload_path, binary_name, target_triple, config, format \\ :release)

@spec build(Path.t(), String.t(), String.t(), keyword(), :release | :escript) ::
  :ok | {:error, String.t()}

Injects the payload into the Rust template and builds the binary.

  • payload_path - Path to the compressed payload tarball

  • binary_name - Name for the final executable

  • target_triple - Rust target triple (e.g., "x86_64-unknown-linux-musl")

  • config - Mix project configuration

  • format - Output format (:release or :escript)

  • :ok - Success

  • {:error, reason} - Failure

initialize_dispenser(dest_dir)

@spec initialize_dispenser(Path.t()) :: :ok | {:error, File.posix()}

Initializes a temporary directory with the Rust dispenser template.