Cargo Rust Package Manager
github.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
Cargo is the free and open-source official package manager and build system for the Rust programming language, bundled with the Rust toolchain. Created by the Rust team in 2014, Cargo is to Rust what npm is to Node.js or pip is to Python, serving as the primary tool for creating, building, testing, and publishing Rust projects. Key features: project creation: 'cargo new my_project' creates a new binary or library project with a standard directory layout and a git repository. Cargo.toml: the project manifest (TOML format) declares project metadata, dependencies with version constraints, features, build profiles, and targets. Dependencies are resolved semantically. Dependency management: downloads dependencies from crates.io, resolves version constraints using a SAT solver, and caches them locally. Dependencies are compiled once and shared across projects. Build: 'cargo build' compiles the project and all dependencies, producing an optimized binary in target/release or a debug binary in target/debug. Handles incremental compilation. Test: 'cargo test' runs all unit tests, integration tests, and documentation tests (code examples in doc comments that are compiled and executed). Run: 'cargo run' compiles and executes the binary. Doc: 'cargo doc' generates API documentation from doc comments using rustdoc. Publish: 'cargo publish' uploads the package to crates.io. Workspaces: manage multiple related crates in a single repository with shared target directory. Features: conditional compilation of optional dependencies and code paths for modular builds. Editions: support for Rust editions (2015, 2018, 2021). MIT/Apache-2.0.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike