Questions

Rust questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Accessing Cargo Package Metadata in Rust

Learn how to read Cargo package metadata like version, name, and authors in Rust using compile-time environment macros.

rustrust-cargo

Associated Types vs Generic Type Parameters in Rust: When to Use Each

Learn when to use associated types vs generic parameters in Rust traits, with clear rules, examples, and practical API design advice.

rusttypesidioms

Convert an Integer to a String in Rust

Learn the current Rust way to convert integers to strings, why `to_str()` no longer works, and when to use `to_string()` or `format!`.

ruststringtype-conversioninteger

Default Function Arguments in Rust: What to Use Instead

Learn how Rust handles default function arguments, why they are not supported, and practical patterns to achieve similar behavior.

rustfunctionparametersarguments

Does `cargo install` Have an Update Command in Rust?

Learn how to update globally installed Cargo packages in Rust, what `cargo install` does, and the common ways developers reinstall tools safely.

rustrust-cargo

Fixing Rust "link.exe not found" on Windows: Understanding the MSVC Linker

Learn why Rust on Windows fails with "link.exe not found" and how MSVC toolchains, linkers, and Visual C++ build tools work.

rustcompiler-errorsinstallationlinker-errors

Fixing Rust "linker 'cc' not found" on Debian in WSL

Learn why Rust shows "linker 'cc' not found" on Debian in WSL and how to fix it by installing the required C build tools.

rustlinuxwindows

Global Variables in Rust: statics, shared state, and better alternatives

Learn whether Rust supports global variables, how `static` works, why `static mut` is risky, and safer patterns for shared state.

rustglobal-variables

Handling Errors While Mapping Iterators in Rust

Learn how to stop iterator processing and return errors in Rust using collect, Result, and iterator patterns.

rustrust-result

How Rust i128 Works on 64-Bit Systems

Learn how Rust's i128 and u128 work on 64-bit CPUs, including memory layout, arithmetic, compiler support, and practical examples.

rustx86-64bigintint128

How to Access Command Line Arguments in Rust

Learn how to read command line arguments in Rust using std::env::args, with examples, common mistakes, and practical patterns.

rustcommand-line

How to Benchmark Programs in Rust

Learn how to measure execution time and benchmark Rust code using Instant, cargo bench, and practical benchmarking patterns.

rusttimebenchmarking

How to Build Multiple Binaries with Cargo in Rust

Learn how to build multiple binaries with Cargo in Rust, including daemon/client layouts, shared libraries, and Cargo.toml setup.

rustrust-cargo

How to Concatenate Strings in Python: str and String-Like Values

Learn how to concatenate strings in Python, including str values and string-like objects, with examples, mistakes, and best practices.

ruststringstring-concatenation

How to Concatenate Vectors in Rust

Learn how to concatenate vectors in Rust using append, extend, iterators, and ownership rules with clear examples and common pitfalls.

rustvectorconcatenation

How to Convert String to &'static str in Rust

Learn how String, &str, and &'static str differ in Rust, when conversion is possible, and safe ways to create static string slices.

rust

How to Convert Vec<u8> or &[u8] to String in Rust

Learn how to convert Vec<u8> or &[u8] to String in Rust, handle UTF-8 safely, and print TCP response buffers correctly.

rust

How to Convert a String to an Integer in Rust

Learn how to convert String and &str to integers in Rust using parse, borrowing, and error handling with clear examples.

rust

How to Create a Global Mutable Singleton in Rust

Learn safe ways to build a global mutable singleton in Rust, including statics, lazy initialization, Mutex, and OnceLock patterns.

rust

How to Disable Dead Code Warnings at the Crate Level in Rust

Learn how crate-level attributes work in Rust and how to disable dead_code warnings across an entire crate safely and clearly.

rustcompiler-warningsdead-code

Page 1 of 4 - 62 questions

PreviousNext