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 toolchain.channel field in the rust-toolchain.toml file
  • 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

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>
VariableDescriptionExample
RAILPACK_RUST_VERSIONOverride the Rust version1.85.1

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