Rust toolchains: Difference between revisions

From wikinotes
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{|
|-
| [[rust cargo]]
|-
|}


= cargo =
<blockquote>
[[rust cargo]] is rust's build system, project, and package manager.<br>
nearly all other tools are abstracted through cargo.


= rustc =
</blockquote><!-- cargo -->
 
= rustup =
<blockquote>
<blockquote>
<code>rustc</code> is the rust compiler.
The rust toolchain installer


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
rustc foo.rs # compiles 'foo' executable from foo.rs
rustup update # update latest rustc
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- rustc -->
</blockquote><!-- rustup -->


= cargo =
= rustc =
<blockquote>
<blockquote>
<code>cargo</code> is rust's build system and package manager.
<code>rustc</code> is the rust compiler.


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

Latest revision as of 23:37, 9 February 2023

cargo

rust cargo is rust's build system, project, and package manager.
nearly all other tools are abstracted through cargo.

rustup

The rust toolchain installer

rustup update  # update latest rustc

rustc

rustc is the rust compiler.

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