Getting Started Flashcards
(38 cards)
Which tool is recommended for installing and managing Rust versions?
rustup, a command-line installer and version manager for Rust toolchains.
Why does the book tell you to install the stable toolchain?
Rust’s stability guarantees mean examples written for today’s stable compiler will keep compiling with future stable releases.
Why might you need a C compiler after installing Rust?
Rust links final binaries and many crates include C code; a C tool-chain provides the linker.
How do you confirm Rust is installed correctly?
Run rustc –version; you should see rustc x.y.z (commit-hash yyyy-mm-dd).
Single command to keep Rust up to date?
rustup update downloads and installs the newest stable toolchain.
If you don’t want to use rustup, where should you look?
The Other Rust Installation Methods page linked near the top of the guide.
What shorthand nickname do Rust developers use for themselves?
Rustaceans—you’ll see the term on the community sites.
What is the mandatory entry-point function that every executable Rust program must define?
main (it’s the first code that runs).
Where are a function’s body and its statements placed in Rust?
Inside { } curly braces following the function header.
What file-name extension must every Rust source file use?
.rs
When a filename contains multiple words, what delimiter is conventional in Rust?
An underscore, e.g., hello_world.rs (not helloworld.rs).
Which command compiles a single Rust source file?
rustc <filename>.rs (e.g., rustc main.rs).</filename>
Which Rust construct prints text to the terminal in the “Hello, world!” example?
The macro println!(“Hello, world!”);.
How can you visually distinguish a macro call from a function call in Rust?
A macro ends with an exclamation mark (!), e.g., println!.
What punctuation ends most Rust statements and expressions?
A semicolon (;).
Why is Rust described as an “ahead-of-time compiled” language?
You compile to a standalone binary that can run on a machine without Rust installed.
Compared with dynamic languages like Python or JavaScript, what extra step does Rust require before execution?
An explicit compilation step separate from running the program.
What automatic formatting tool ships with the standard Rust distribution?
rustfmt
Which language-server/IDE helper is the Rust team focusing on?
rust-analyzer
Why might you separate compiling and running when your Rust project grows?
To manage many build options and dependencies more easily (leading to the introduction of Cargo).
What is Cargo?
Cargo is Rust’s build system and package manager; it builds your code, fetches dependencies (called crates), and builds those crates too.
How do you verify that Cargo is installed?
Run cargo –version in your terminal; a version string indicates success.
Which command creates a brand-new Cargo project?
cargo new project_name (e.g., cargo new hello_cargo).
What three items does cargo new generate?
A Cargo.toml file, a src directory containing main.rs, and (by default) an initialized Git repository with .gitignore.