- Documentation
- Technologies
- Rust
Rust
Guara Cloud fully supports Rust applications, including frameworks like Actix Web, Axum, Rocket, and any other Rust-based project. Rust’s compiled nature produces small, fast binaries that are ideal for containerized deployments.
Supported versions
The following Rust versions are auto-detected by Buildpack:
- Rust 1.80
- Rust 1.81
- Rust 1.82
The version is determined from the rust-version field in your Cargo.toml or from a rust-toolchain.toml file. If no version is specified, the latest stable version is used.
# Cargo.toml
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"
rust-version = "1.82"
Deploy with Dockerfile
A multi-stage build is the recommended approach for Rust applications. It compiles your binary in a full Rust environment, then copies only the binary into a minimal runtime image.
Deploy with Buildpack
If your repository does not contain a Dockerfile, Guara Cloud automatically detects your Rust project by the presence of a Cargo.toml file in the root directory.
The Buildpack will:
- Detect the Rust version from
Cargo.tomlorrust-toolchain.toml - Download dependencies and cache them for faster rebuilds
- Build your application in release mode with
cargo build --release - Start the compiled binary
Cargo workspaces are also supported. The Buildpack detects the workspace structure and builds the appropriate binary.
Port configuration
Your application must listen on the port configured in your service settings. The default is 3000, but you can change it at any time to match your application.
use std::env;
let port = env::var("PORT").unwrap_or_else(|_| "3000".to_string());
let addr = format!("0.0.0.0:{}", port);
Example project structure
my-rust-app/
Cargo.toml
Cargo.lock
src/
main.rs
routes/
models/
Dockerfile # optional — omit to use Buildpack
Environment variables
These environment variables are commonly used with Rust deployments:
| Variable | Recommended value | Description |
|---|---|---|
PORT | Set by platform | The port your application must listen on |
RUST_LOG | info | Controls log verbosity for the tracing/env_logger crate |
RUST_BACKTRACE | 1 | Enables backtraces on panic for easier debugging |