Rust cargo: Difference between revisions
From wikinotes
(→Usage) |
No edit summary |
||
Line 1: | Line 1: | ||
cargo is rust's | cargo is rust's build system, and package manager. | ||
= Documentation = | = Documentation = | ||
Line 9: | Line 9: | ||
|} | |} | ||
</blockquote><!-- documentation --> | </blockquote><!-- documentation --> | ||
= Locations = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| <code>${PROJECT}/Cargo.toml</code> || project config | |||
|- | |||
|} | |||
</blockquote><!-- Locations --> | |||
= Usage = | = Usage = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
cargo new my_project | cargo new my_project # create project | ||
cargo build | cargo build # compile project (for testing) | ||
cargo run | cargo run # compile/run executable | ||
cargo check # check project can build, without building | |||
cargo build --release # build w/ optimizations (more performant) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- usage --> | </blockquote><!-- usage --> | ||
= Configuration = | |||
<blockquote> | |||
<syntaxhighlight lang="toml"> | |||
[package] | |||
name = "hello_cargo" | |||
version = "0.1.0" | |||
authors = ["Your Name <you@example.com>"] | |||
edition = "2018" | |||
[dependencies] | |||
</syntaxhighlight> | |||
</blockquote><!-- Configuration --> |
Revision as of 23:46, 7 September 2021
cargo is rust's build system, and package manager.
Documentation
official docs https://doc.rust-lang.org/book/ch01-03-hello-cargo.html
Locations
${PROJECT}/Cargo.toml
project config
Usage
cargo new my_project # create project cargo build # compile project (for testing) cargo run # compile/run executable cargo check # check project can build, without building cargo build --release # build w/ optimizations (more performant)
Configuration
[package] name = "hello_cargo" version = "0.1.0" authors = ["Your Name <you@example.com>"] edition = "2018" [dependencies]