rust

Manage Rust toolchains and automate cargo build, test, and cross-compile workflows.

Updated Jul 2, 2024
One-click install
npx skills add https://github.com/jyasuu/cheat-sheet --skill rust-jyasuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust
Source: https://github.com/jyasuu/cheat-sheet/tree/main/skills/rust
Command: npx skills add https://github.com/jyasuu/cheat-sheet --skill rust-jyasuu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Rust-focused guide consolidates essential Rust and Cargo commands, simplifying toolchain setup, project building, testing, and cross-compilation workflows for developers.

Core Features & Use Cases

  • Toolchain setup and management: Install and switch between stable and target toolchains with rustup.
  • Cargo-driven workflows: Create, build, test, run, and package Rust crates efficiently across environments.
  • Cross-compilation guidance: Add targets (e.g., x86_64-unknown-linux-gnu, x86_64-unknown-linux-musl) and build for multiple platforms.
  • Use Case: A developer wants to bootstrap a new crate, compile a release binary for a musl-based Linux environment, and run unit tests in CI.

Quick Start

Install the Rust toolchain with rustup, initialize a new project with cargo new my_project, then build and run for the target platform.

Frequently Asked Questions about rust

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cross-compile a Rust project for a musl-based Linux target?

Cross-compiling a Rust project for musl requires adding the specific target like x86_64-unknown-linux-musl via rustup, then running your cargo build command with the target flag to generate the platform-specific binary.

What is the best way to manage multiple Rust toolchains in a CI environment?

Managing multiple Rust toolchains in CI involves using rustup to install and switch between stable or specific target toolchains, ensuring reproducible builds across different pipeline runs and environments.

How do I bootstrap a new Rust crate and run unit tests with cargo?

Bootstrapping a new Rust crate and running tests uses cargo new to initialize the project structure, followed by cargo test to automatically compile and execute all unit tests defined in the codebase.

Do I need rustup installed to manage Rust cross-compilation targets?

Yes, you need rustup installed because it serves as the primary toolchain manager to add specific cross-compilation targets and switch between stable toolchains required by cargo workflows.

Can I use cargo workflows to build and package release binaries across different platforms?

Yes, you can use cargo workflows to build and package release binaries across different platforms by configuring the target triples in your cargo build commands and generating the executable artifacts.