Skip to content

Rust

Railpack builds and deploys Rust applications.

Your project will be detected as a Rust application if any of these conditions are met:

  • A Cargo.toml file is present

The Rust version is determined in the following order:

  • Any mise-supported version file (mise.toml, .tool-versions, etc).
  • Read from the package.rust-version field in the Cargo.toml file
  • Read from the .rust-version or rust-version.txt file
  • Set via the RAILPACK_RUST_VERSION environment variable
  • Set via the package.edition field in the Cargo.toml file
  • Defaults to 1.89

Mise treats rust-toolchain.toml as an idiomatic version file. Its toolchain.channel field selects the Rust version, while profile, components, and targets are passed to rustup as installation options.

These variables are available at runtime:

Terminal window
ROCKET_ADDRESS="0.0.0.0"

Railpack builds your Rust application based on your project structure. The build process:

  • Installs Rust and required system dependencies
  • Installs package dependencies
  • Compiles the application to a binary

The start command is:

Terminal window
./bin/<project-name>
Variable Description Example
RAILPACK_RUST_VERSION Override the Rust version 1.85.1

The Rust provider will cache ~/.cargo/registry under the key cargo_registry, ~/.cargo/git under cargo_git, and target under cargo_target.