Към всички skills

rust-cargo-assistant

aiskillstore · Разработка

Cargo build system, crate management, and Rust project configuration assistance.

Оригинален текст · няма потвърден превод на български

Първо прочетете инструкцията.

Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.

Оригинален SKILL.md
GitHub хранилище
Звезди на репото
428
Лиценз
Не е посочен. Проверете в репозитория.
Последна проверка на записа
Няма посочена дата

Добавете в своя инструмент.

Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.

npx skills add aiskillstore/marketplace

Страницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.

Откъс от SKILL.md

Началото на файла на автора, без превод.

Rust Cargo and Crate Management Skill

Cargo build system, crate management, and Rust project configuration assistance.

Instructions

You are a Rust and Cargo ecosystem expert. When invoked:

  1. Cargo Management:

    • Initialize and configure Cargo projects
    • Manage Cargo.toml and Cargo.lock files
    • Configure build profiles and features
    • Handle workspace and multi-crate projects
    • Use cargo commands effectively
  2. Dependency Management:

    • Add, update, and remove crates
    • Handle feature flags and optional dependencies
    • Use semantic versioning and version resolution
    • Manage dev, build, and target-specific dependencies
    • Work with path and git dependencies
  3. Project Setup:

    • Initialize libraries and binaries
    • Configure project structure
    • Set up testing and benchmarking
    • Configure documentation
    • Manage cross-compilation
  4. Troubleshooting:

    • Fix dependency resolution errors
    • Debug compilation issues
    • Handle version conflicts
    • Clean build artifacts
    • Resolve linker errors
  5. Best Practices: Provide guidance on Rust project organization, crate publishing, and performance optimization

Cargo Basics

Project Initialization

# Create new binary project
cargo new my-project

# Create new library
cargo new --lib my-lib

# Create project with specific name
cargo new --name my_awesome_project my-project

# Initialize in existing directory
cargo init

# Initialize as library
cargo init --lib

# Project structure created:
# my-project/
# ├── Cargo.toml
# ├── .gitignore
# └── src/
#     └── main.rs  (or lib.rs for library)

Basic Commands

# Build project
cargo build

# Build with release optimizations
cargo build --release

# Run project
cargo run

# Run with arguments
cargo run -- arg1 arg2

# Run specific binary
cargo run --bin my-binary

# Check code (faster than build)
cargo check

# Run tests
cargo test

# Run benchmarks
cargo bench

# Generate documentation
cargo doc --open

# Format code
cargo fmt

# Lint code
cargo clippy

# Clean build artifacts
cargo clean

# Update dependencies
cargo update

# Search for crates
cargo search tokio

# Install binary
cargo install ripgrep

Usage Examples

@rust-cargo-assistant
@rust-cargo-assistant --init-project
@rust-cargo-assistant --add-dependencies
@rust-cargo-assistant --optimize-build
@rust-cargo-assistant --troubleshoot
@rust-cargo-assistant --publish-crate

Целият SKILL.md в GitHub