RustToolChain.jl is a Julia package that provides Rust toolchains (especially cargo) using Julia's Artifacts system. You can build and run Rust projects directly from Julia without installing Rust on your system.
- 🦀 Provides Rust 1.92.0 toolchain
- 📦 Automatic download and management via Julia's Artifacts system
- 🖥️ Supports multiple platforms and architectures
- 🚀 Simple API to execute
cargocommands
- Linux: x86_64 (glibc, musl), aarch64 (glibc, musl), i686 (glibc, musl)
- macOS: x86_64, aarch64
- Windows: x86_64, aarch64
using Pkg; Pkg.add("RustToolChain")using RustToolChain: cargo
# Execute cargo command
run(`$(cargo()) --version`)
# Build a Rust project
run(`$(cargo()) build`)
# Run a Rust project
run(`$(cargo()) run`)This repository includes a simple example:
git clone https://github.com/AtelierArith/RustToolChain.jl.git
cd RustToolChain.jl
julia --project -e 'using Pkg; Pkg.instantiate()'
cd examples
julia --project run.jlOr from the Julia REPL:
using Pkg
Pkg.activate("examples")
Pkg.instantiate()
include("examples/run.jl")Returns a command object for executing Rust's cargo command.
Returns: Cmd object (usable with Julia's backtick syntax)
Examples:
using RustToolChain: cargo
# Check cargo version
run(`$(cargo()) --version`)
# Create a new Rust project
run(`$(cargo()) new my_project`)
# Build project
run(`$(cargo()) build --release`)This package uses Julia's Artifacts system to automatically download and manage Rust toolchains. On first use, the appropriate Rust toolchain for your platform will be automatically downloaded.
RustToolChain.jl/
├── src/
│ └── RustToolChain.jl # Main Julia module
├── examples/
│ ├── hello/ # Example Rust project
│ └── run.jl # Julia script demonstrating usage
├── gen/
│ └── generate_Artifacts_toml.jl # Script to generate Artifacts.toml
├── test/
│ └── runtests.jl # Julia test script
├── .github/workflows/
│ ├── CI.yml # Continuous integration tests
│ └── bump-rust-stable.yml # Auto-update Rust toolchain
├── Artifacts.toml # List of artifact dependencies
└── Project.toml # Julia package manifest
This package automatically checks for new Rust stable releases and creates pull requests to update the toolchain.
Automated Workflow:
- Runs weekly (every Monday at 00:00 UTC)
- Fetches the latest Rust stable version from
https://static.rust-lang.org/dist/channel-rust-stable.toml - Regenerates
Artifacts.tomlwith the new version - Updates the version in
README.md - Creates a pull request if changes are detected
Manual Update:
You can manually regenerate Artifacts.toml for a specific Rust version:
julia --project=gen gen/generate_Artifacts_toml.jl <RUST_VERSION>
# Example:
julia --project=gen gen/generate_Artifacts_toml.jl 1.93.0The script validates the version format (X.Y.Z) and provides clear error messages for invalid input.
Please refer to the LICENSE file in the repository for license information.
- Satoshi Terasaki [email protected]