Rust
vx provides support for the Rust programming language and its toolchain.
Supported Tools
| Tool | Description |
|---|---|
rust | Rust toolchain (rustc, cargo, etc.) |
cargo | Rust package manager |
rustc | Rust compiler |
Installation
bash
vx install rust stable
vx install rust nightly
vx install rust 1.75.0Download Format
vx downloads Rust toolchains in .tar.gz format for all platforms (Windows, macOS, Linux). This ensures consistent extraction behavior across all operating systems and avoids platform-specific installer formats like .msi.
The download URLs follow the pattern:
https://static.rust-lang.org/dist/rust-{version}-{platform}.tar.gzVersion Specifiers
bash
rust stable # Stable channel
rust beta # Beta channel
rust nightly # Nightly channel
rust 1.75.0 # Specific versionCargo
Basic Commands
bash
vx cargo --version
vx cargo new my-project
vx cargo initBuilding
bash
vx cargo build
vx cargo build --release
vx cargo build --target x86_64-unknown-linux-muslRunning
bash
vx cargo run
vx cargo run --release
vx cargo run -- --arg valueTesting
bash
vx cargo test
vx cargo test --release
vx cargo test -- --nocaptureDependencies
bash
vx cargo add serde
vx cargo add tokio --features full
vx cargo remove serde
vx cargo updatePublishing
bash
vx cargo publish --dry-run
vx cargo publishRustc
bash
vx rustc --version
vx rustc main.rs -o mainProject Configuration
toml
[tools]
rust = "stable"
[scripts]
build = "cargo build --release"
test = "cargo test"
lint = "cargo clippy -- -D warnings"
format = "cargo fmt"
doc = "cargo doc --open"Common Workflows
New Project
bash
vx cargo new my-project
cd my-project
vx cargo runLibrary Project
bash
vx cargo new --lib my-lib
cd my-lib
vx cargo testWeb Server with Axum
bash
vx cargo new my-server
cd my-server
vx cargo add axum tokio --features tokio/full
# Create src/main.rs
vx cargo runCLI Tool with Clap
bash
vx cargo new my-cli
cd my-cli
vx cargo add clap --features derive
# Create src/main.rs
vx cargo build --releaseCross-Compilation
bash
# Add target
vx rustup target add x86_64-unknown-linux-musl
# Build for target
vx cargo build --release --target x86_64-unknown-linux-muslCode Quality
bash
# Format code
vx cargo fmt
# Lint with Clippy
vx cargo clippy
# Check without building
vx cargo checkTips
- Use stable for production: Unless you need nightly features
- Run clippy regularly: Catches common mistakes
- Use cargo fmt: Consistent formatting
- Pin rust-toolchain.toml: For team consistency