FlashKeepers

Rust · College · College and University

Rust VI: Cargo, Modules and Unsafe

Cargo commands, crates, modules and visibility, workspaces, testing, macros and unsafe Rust.

About this set

36 basic cards for College Rust. Set 6 of 6 in Rust. It opens with "What Cargo command creates a new binary project with a main.rs file?" and "What does `cargo build` do?". Study it alongside the other College sets below.

36 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What Cargo command creates a new binary project with a main.rs file?
Show answercargo new <project-name>
What does `cargo build` do?
Show answerCompiles the project and creates a binary executable in target/debug
What is the difference between `cargo build` and `cargo check`?
Show answercargo check verifies code compiles without producing a binary, faster than cargo build
What does `cargo run` do?
Show answerCompiles and immediately executes the binary in one command
What does `cargo test` compile and execute?
Show answerAll test functions marked with #[test] attribute
What does `cargo doc` generate?
Show answerHTML documentation from doc comments in the source code
What is the purpose of Cargo.toml?
Show answerDefine project metadata, dependencies, and build configuration
What Cargo.toml section contains the project name, version, and edition?
Show answer[package]
What is a library crate?
Show answerA crate that provides reusable code, has no main function, root is src/lib.rs
What is a binary crate?
Show answerA crate compiled to an executable program with a main function as root is src/main.rs
What is the default crate root file for a library?
Show answersrc/lib.rs
What is the default crate root file for a binary?
Show answersrc/main.rs
In Rust 2018 edition and later, is `extern crate` needed?
Show answerNo, external crates are brought into scope automatically via use statements
What does the `pub` keyword do?
Show answerMakes an item public, accessible from outside its defining module
What does `pub(crate)` visibility restrict access to?
Show answerItems only accessible within the current crate, not from external crates

21 more cards in the app

Study this set free