adding-dependencies

Manage Rust crate dependencies centrally in root Cargo.toml with workspace=true and sorted order.

1.5k|207|Updated Nov 24, 2023
One-click install
npx skills add https://github.com/golemcloud/golem --skill adding-dependencies
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dependencies
Source: https://github.com/golemcloud/golem/tree/main/.agents/skills/adding-dependencies
Command: npx skills add https://github.com/golemcloud/golem --skill adding-dependencies

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of adding, updating, and managing Rust crate dependencies within the Golem workspace, ensuring consistency and adherence to best practices.

Core Features & Use Cases

  • Centralized Dependency Management: All dependencies are managed via the root Cargo.toml's [workspace.dependencies] section.
  • Simplified Updates: Changing a version in one place updates it across the entire workspace.
  • Use Case: When you need to add a new logging library to your Rust project, this Skill guides you through updating the root Cargo.toml and then referencing it in your specific crate.

Quick Start

Add the 'serde' crate with version '1.0.150' to the workspace dependencies.

Frequently Asked Questions about adding-dependencies

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

FAQPage Schema
How do I add Rust crate dependencies to a Cargo workspace?

To add Rust crate dependencies to a Cargo workspace, define them in the root `Cargo.toml` under `[workspace.dependencies]` with the desired version, then reference them in member crates using `workspace = true`.

How does workspace dependency management work in Rust?

Workspace dependency management centralizes external library definitions in the root `Cargo.toml`, allowing member crates to reference shared versions and features via `workspace = true` for simplified updates and consistency.

What is the best way to update dependency versions across multiple Rust crates?

The best way to update dependency versions across multiple Rust crates is by centralizing definitions in the root `Cargo.toml`'s `[workspace.dependencies]` section, so changing a version once propagates it across the entire workspace.

Does adding dependencies to a Cargo workspace require alphabetical sorting?

Yes, adding dependencies to a Cargo workspace requires alphabetical sorting within the `Cargo.toml` file to ensure adherence to project consistency standards and best practices.

Can I configure features for external libraries in a Rust workspace?

Yes, you can configure features for external libraries by specifying them alongside the version in the root `Cargo.toml`'s `[workspace.dependencies]` section, enabling consistent feature flags across all workspace member references.

Why does my Rust workspace dependency reference fail to compile?

Rust workspace dependency references fail to compile if `workspace = true` is omitted in the member crate's `Cargo.toml` or if the dependency is not properly defined in the root `[workspace.dependencies]` section.