All syntax guides
Short, practical guides on programming syntax, language fundamentals, and the tools developers reach for every day.
3,965 guides across 14 topics
Topics
Popular guides
Most readLatest guides
Page 26 of 397Rust Macros: macro_rules! Patterns, Hygiene, and Procedural Macros
Matcher fragments, repetition, hygiene and the proc-macro crate. How to read a macro_rules! error and when a derive macro is the right tool.
Rust Strings Explained: &str vs String, UTF-8 Indexing, and Conversions
Why s[0] does not compile, why slicing can panic, and when a &str becomes an owned String. The UTF-8 rules behind every Rust string error.
Rust Collections: Vec, HashMap, BTreeMap, and the Entry API
Vec for sequences, HashMap for keyed lookup, BTreeMap for order. Where the Entry API removes a lookup, and why index removal is O(n).
Rust Modules and Crates: mod, pub Visibility, use Paths, and Workspaces
Modules decide privacy, crates decide compilation, workspaces decide sharing. The file layout, visibility levels and Cargo wiring that hold them together.
Rust Generics: Type Parameters, Where Clauses, and Monomorphization
How generics become zero-cost code, why where clauses are not cosmetic, and how monomorphization turns one function into many.
Rust Async Await: Futures, Pinning, and Tokio Task Execution
An async fn runs nothing until an executor polls it. Await points, Send bounds, blocking in a worker, cancellation and the runtime nesting panic.
Rust Concurrency: Spawning Threads, mpsc Channels, and Arc<Mutex<T>>
Ownership rules make data races a compile error. Sharing with Arc<Mutex>, sending with mpsc, and the lock ordering and sender-lifetime mistakes that hang.
Rust Structs and Enums: Tuple Structs, Methods, and Algebraic Data Types
Struct is and, enum is or. Newtypes that stop argument mix-ups, receivers that decide ownership, and state machines where illegal states cannot be built.
Rust Iterators and Closures: map, filter, and move Semantics
Iterators are lazy and monomorphised into loops. The three consumption forms, the Fn trait ladder, and why an adapter chain with no consumer does nothing.
Rust Smart Pointers: Box, Rc, Arc, and RefCell with Interior Mutability
Four pointers, four policies: single owner, shared single-thread, shared multi-thread, and a runtime borrow check. The cycles that leak and the panics that bite.