Skip to content

RFE: Add Rust programming language support with Cargo #50

@gnodet

Description

@gnodet

🦀 Request for Enhancement: Rust Programming Language Support

📋 Overview

Add comprehensive support for the Rust programming language and Cargo package manager to mvx, enabling Rust projects to be managed with the same ease as other supported languages.

🚀 Motivation

Rust is rapidly growing in popularity for:

  • Systems programming (replacing C/C++ in many use cases)
  • Web development (backend services, WebAssembly)
  • CLI tools (fast, reliable command-line applications)
  • Blockchain and crypto (performance-critical applications)
  • Cross-platform development (single codebase, multiple targets)

Adding Rust support would make mvx a more complete polyglot development environment.

Proposed Features

🦀 Core Tool Implementation

  • rustup-init based installation: Use official Rust installer for proper toolchain management
  • Version discovery: Support for 49+ versions from 1.50.0 to latest with fallback system
  • Cross-platform support: Linux (x64, aarch64), macOS (x64, aarch64), Windows (x64)
  • Complete toolchain: Includes rustc compiler, cargo package manager, and rustup
  • Special version support: stable, latest, and exact versions

🛠️ CLI Integration

# Search available versions
mvx tools search rust

# Add to project
mvx tools add rust 1.84.0
# Or use aliases
mvx tools add rust stable
mvx tools add rust latest

# List available tools (shows Rust)
mvx tools list

# Get tool information
mvx tools info rust

🌍 Environment Management

  • RUSTUP_HOME: Automatically configured for toolchain management
  • CARGO_HOME: Set up for package management and caching
  • PATH integration: Rust binaries (rustc, cargo) added to PATH during setup
  • Isolated installations: Each version gets its own environment
  • Target support: Enable cross-compilation targets as needed

📝 Configuration Examples

// .mvx/config.json5
{
  tools: {
    rust: { version: "1.84.0" }
  },
  commands: {
    "build": {
      description: "Build Rust project",
      script: "cargo build"
    },
    "test": {
      description: "Run tests",
      script: "cargo test"
    },
    "run": {
      description: "Run the application",
      script: "cargo run"
    },
    "release": {
      description: "Build optimized release",
      script: "cargo build --release"
    }
  }
}

🔧 Implementation Details

  • Download source: https://static.rust-lang.org/rustup/dist/{arch}/rustup-init
  • Installation method: Use rustup-init with --default-toolchain for version control
  • Verification: Validate both rustc --version and cargo --version
  • Toolchain structure: Follow standard rustup directory layout
  • Environment isolation: Each version maintains separate RUSTUP_HOME and CARGO_HOME
  • Platform detection: Automatic architecture detection for download URLs

🧪 Testing Requirements

  • Unit tests: Comprehensive coverage for all Rust tool functionality
  • Integration tests: End-to-end testing with real Rust projects
  • Cross-platform: Platform-specific rustup-init URL generation testing
  • Installation structure: Toolchain directory detection and binary verification
  • Real project testing: Create and build actual Rust applications
  • Cargo ecosystem: Test package management and dependency resolution

📚 Documentation Needs

  • Update website/content/tools.md with Rust/Cargo usage examples
  • Add system Rust detection documentation for CI environments
  • Include configuration examples and toolchain management info
  • Document cross-compilation capabilities
  • Add examples for common Rust project types (CLI, web, library)

🏗️ Architecture Benefits

  • Follows rustup conventions: Uses official Rust toolchain manager
  • Version flexibility: Supports exact versions, major.minor patterns, and aliases
  • Proper isolation: No conflicts between different Rust versions
  • Standard tooling: Full cargo ecosystem available out of the box
  • Cross-compilation ready: Foundation for multi-target builds

🎁 Benefits

  1. Modern language support: Add one of the fastest-growing programming languages
  2. Systems programming: Enable low-level development alongside high-level languages
  3. Performance: Support for performance-critical applications
  4. Safety: Memory-safe systems programming
  5. Cross-platform: Single codebase targeting multiple platforms
  6. Growing ecosystem: Access to rapidly expanding Rust package ecosystem

🔗 Related

  • Complements existing language support (Java, Go, Node.js)
  • Follows established tool implementation patterns
  • Enables polyglot development workflows
  • Previous implementation available in closed PR Add Rust programming language support with Cargo #10 (needs rewrite due to conflicts)

📋 Acceptance Criteria

  • Rust tool can be discovered, installed, and verified
  • Support for stable, latest, and exact version specifications
  • Cross-platform compatibility (Linux, macOS, Windows)
  • Comprehensive test coverage including real project builds
  • Documentation and usage examples
  • CLI commands work as expected
  • Environment variables properly configured (RUSTUP_HOME, CARGO_HOME)
  • Integration with cargo package manager
  • Proper toolchain isolation between versions

📈 Usage Scenarios

# CLI tool development
mvx tools add rust stable
mvx setup
cargo new my-cli-tool
cd my-cli-tool
cargo build
cargo run

# Web service development
mvx tools add rust 1.84.0
mvx setup
cargo new my-web-service
cd my-web-service
# Add web framework dependencies
cargo add tokio axum
cargo build

# Cross-compilation
rustup target add x86_64-pc-windows-gnu
cargo build --target x86_64-pc-windows-gnu

Priority: Medium
Complexity: Medium
Impact: High (enables modern systems programming support)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions