Rust toolchains: Difference between revisions

From wikinotes
Line 17: Line 17:
= cargo =
= cargo =
<blockquote>
<blockquote>
<code>cargo</code> is rust's build system and package manager.
[[cargo]] is rust's build system and package manager.


<syntaxhighlight lang="bash">
cargo new my_project  # create project
cargo build          # compile project
cargo run            # compile/run executable
</syntaxhighlight>
<syntaxhighlight lang="toml">
[package]
name = "hello_cargo"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
edition = "2018"
[dependencies]
</syntaxhighlight>
</blockquote><!-- cargo -->
</blockquote><!-- cargo -->

Revision as of 23:40, 7 September 2021

rust cargo


rustc

rustc is the rust compiler.

rustc foo.rs  # compiles 'foo' executable from foo.rs

cargo

cargo is rust's build system and package manager.