Datasets:
messages listlengths 2 2 |
|---|
[
{
"role": "user",
"content": "Why won't this compile?\n\n```rust\nfn duplicate_evens(v: &mut Vec<i32>) {\n for x in v.iter() {\n if x % 2 == 0 {\n v.push(*x);\n }\n }\n}\n```"
},
{
"role": "assistant",
"content": "`v.iter()` holds a shared borrow of `v` for the who... |
[
{
"role": "user",
"content": "I need to parse a simple config format: `key = value` lines, where values are unsigned integers, `#` starts a comment line, and blank lines are ignored. Errors should report the line number. No external crates."
},
{
"role": "assistant",
"content": "Use a dedicated ... |
[
{
"role": "user",
"content": "Write an iterator over whitespace-separated words that yields `&str` slices of the original string, with no allocation. Explain the lifetimes."
},
{
"role": "assistant",
"content": "The iterator stores the not-yet-consumed rest of the input as a `&'a str`. Each call... |
[
{
"role": "user",
"content": "how do i sum a huge slice across multiple threads without Arc or copying the data"
},
{
"role": "assistant",
"content": "Use `std::thread::scope` (stable since 1.63). Threads spawned in a scope are guaranteed to be joined before the scope returns, so they can borrow... |
[
{
"role": "user",
"content": "Show me the typestate pattern: a request builder where calling `build()` before setting a URL is a compile error, not a runtime error."
},
{
"role": "assistant",
"content": "Encode \"has a URL\" in the builder's type parameter. `build` only exists on `RequestBuilder... |
[
{
"role": "user",
"content": "The borrow checker rejects this:\n\n```rust\nlet a = &mut v[i];\nlet b = &mut v[j];\nstd::mem::swap(a, b);\n```\n\nHow do I get two mutable references into the same slice at different indices?"
},
{
"role": "assistant",
"content": "The compiler can't prove `i != j` ... |
[
{
"role": "user",
"content": "Write a generic run-length encoder that works on any iterator, not just strings."
},
{
"role": "assistant",
"content": "Accept `IntoIterator` so callers can pass a `Vec`, a `&[T]`, `chars()`, or any other iterator. The only requirement on items is `PartialEq`, becau... |
[
{
"role": "user",
"content": "When should I use `Box<dyn Trait>` instead of generics? Give a concrete example where generics don't work."
},
{
"role": "assistant",
"content": "Generics are monomorphized: `fn f<T: Trait>(x: T)` gets compiled once per concrete `T`. That gives you static dispatch a... |
[
{
"role": "user",
"content": "Implement a fixed-capacity ring buffer with const generics. When it's full, pushing should evict the oldest element. Don't require `T: Copy` or `T: Default`."
},
{
"role": "assistant",
"content": "Store `[Option<T>; N]` and build it with `std::array::from_fn`. That ... |
[
{
"role": "user",
"content": "I want to apply a function to a Vec of jobs on N worker threads and get results back in the original order. std only, no rayon."
},
{
"role": "assistant",
"content": "Share one job queue across the workers and tag each job with its index so results can be put back i... |
[
{
"role": "user",
"content": "Write an HTML escaping function that doesn't allocate when the input has nothing to escape."
},
{
"role": "assistant",
"content": "Return `Cow<'_, str>`. Scan once for the first character that needs escaping. If there isn't one, return the input borrowed. Otherwise ... |
[
{
"role": "user",
"content": "How do I write a `hashmap!` macro like `vec!`, with optional trailing comma?"
},
{
"role": "assistant",
"content": "First, you may not need one. Since Rust 1.56, `HashMap::from([(\"a\", 1), (\"b\", 2)])` builds a map from an array literal. If you want the `key => va... |
[
{
"role": "user",
"content": "here's my code, what's wrong? I want to greet everyone and then print how many people there were.\n\n```rust\nfn greet(names: Vec<String>) -> String {\n format!(\"Hello, {}!\", names.join(\", \"))\n}\n\nfn main() {\n let names = vec![\"Ana\".to_string(), \"Bo\".to_string(... |
[
{
"role": "user",
"content": "why does `let full = base + \"/\" + part;` make `base` unusable afterwards? i thought + just reads both sides. can you write me a `join_path(base, parts)` that handles extra slashes properly"
},
{
"role": "assistant",
"content": "`+` on strings is `impl Add<&str> fo... |
[
{
"role": "user",
"content": "Write a 2D `Point` type I can pass by value and keep using afterwards, plus a `Polygon` that owns a list of points. Explain why one can be `Copy` and the other can't."
},
{
"role": "assistant",
"content": "A type can be `Copy` only if a plain bitwise copy of it is a... |
[
{
"role": "user",
"content": "when should my fn take String vs &str?? i have a slugify fn and a shout fn (uppercases + adds !) and i keep getting \"value moved\" when i pass my String into them and then use it again"
},
{
"role": "assistant",
"content": "Ask whether the function needs to **own**... |
[
{
"role": "user",
"content": "Implement a generic stack with `push`, `pop`, `peek`, and `peek_mut`. `pop` should give me the value back, not a reference. It should work for types that aren't `Clone`."
},
{
"role": "assistant",
"content": "`pop` returns `Option<T>`. It **moves** the top element o... |
[
{
"role": "user",
"content": "I'm writing a batcher. It has a `pending: Vec<T>` field and I want `flush(&mut self) -> Vec<T>` to hand back whatever is pending and leave the batcher empty. `self.pending` as the return value gives \"cannot move out of `self.pending` which is behind a mutable reference\". How ... |
[
{
"role": "user",
"content": "This won't compile and I don't get the error message:\n\n```rust\nlet config = Config::load();\nlet mut workers = Vec::new();\nfor id in 0..4 {\n workers.push(Worker::new(id, config));\n}\n```\n\nerror[E0382]: use of moved value: `config` ... value moved here, in previous it... |
[
{
"role": "user",
"content": "Write functions that return closures: one that prefixes strings with a given prefix, one that's a counter starting from some number, and one that hands back a captured String exactly once. Explain what `move` is doing in each."
},
{
"role": "assistant",
"content": "... |
[
{
"role": "user",
"content": "```rust\nlet msg = Message::parse(raw)?;\nlet body = msg.body;\nlog::info!(\"got {:?}\", msg);\n```\n\ncompiler says \"borrow of partially moved value: `msg`\". I only took the body?? Write me a Message type with a proper way to split header and body."
},
{
"role": "ass... |
[
{
"role": "user",
"content": "fn display_name(user: &User) -> &str {\n match user.nickname {\n Some(n) => &n,\n None => &user.login,\n }\n}\n\nE0507 cannot move out of `user.nickname`. nickname is Option<String>. also want blank nicknames to fall back to login. fix pls"
},
{
"rol... |
[
{
"role": "user",
"content": "Write `split_long_words(words: Vec<String>, max_chars: usize) -> (Vec<String>, Vec<String>)` (short words first, long words second) and `group_by_initial(words: Vec<String>) -> BTreeMap<char, Vec<String>>`. No string should be cloned. My current version iterates with `.iter()` ... |
[
{
"role": "user",
"content": "I have an enum for a download:\n\n```rust\nenum Download {\n Idle,\n Fetching { url: String, bytes: Vec<u8> },\n Done { url: String, data: Vec<u8> },\n Failed { url: String, reason: String },\n}\n```\n\nI want `finish(&mut self)` to turn `Fetching` into `Done`, movi... |
[
{
"role": "user",
"content": "here's my code, what's wrong\n\n```rust\nlet q = Query::new(\"users\").filter(\"age > 18\");\nif let Some(n) = limit {\n q.limit(n);\n}\nlet sql = q.build();\n```\n\nerror[E0382]: use of moved value: `q`. my builder methods all take `self` and return `Self`."
},
{
"r... |
[
{
"role": "user",
"content": "Design an API for a transaction on an in-memory key-value store where `commit` or `rollback` can each only be called once and the store can't be touched while a transaction is open. I want the compiler to enforce both, not runtime checks."
},
{
"role": "assistant",
... |
[
{
"role": "user",
"content": "how do i rename a key in a HashMap<String, Vec<Item>> without cloning the vec? get() gives me a reference and insert() wants an owned value. also need a merge where the old key's items get appended to the new key's"
},
{
"role": "assistant",
"content": "Use `remove`... |
[
{
"role": "user",
"content": "I have a guard type with a `Drop` impl that runs a cleanup callback. I want an `into_inner(self) -> T` that disarms it and returns the wrapped value, but `let Guard { value, .. } = self;` gives E0509 \"cannot move out of type `Guard<T, F>`, which implements the `Drop` trait\". ... |
[
{
"role": "user",
"content": "Implement a singly linked stack: push, pop, peek, peek_mut, reverse in place, len, and an owning IntoIterator. No unsafe. Explain why every `take()` is there. And make sure dropping a 100k-element list doesn't blow the stack."
},
{
"role": "assistant",
"content": "E... |
[
{
"role": "user",
"content": "```rust\nlet lines: Vec<String> = load();\nlet mut handles = vec![];\nfor t in 0..4 {\n handles.push(thread::spawn(move || count_in(&lines, t)));\n}\n```\nE0382 value moved into closure here, in previous iteration of loop. Write a parallel \"count lines containing needle\" u... |
[
{
"role": "user",
"content": "Write `extract<T>(v: &mut Vec<T>, pred: impl FnMut(&T) -> bool) -> Vec<T>`: moves every matching item out of `v` into the returned Vec, keeps the order of both, and works for `T` that isn't `Clone`."
},
{
"role": "assistant",
"content": "You can't move items out of ... |
[
{
"role": "user",
"content": "I have a `Playlist { songs: Vec<Song> }`. I want all three of these to work: `for s in &playlist`, `for s in &mut playlist`, and `for s in playlist`. Show the impls and explain which one consumes the playlist."
},
{
"role": "assistant",
"content": "A `for` loop call... |
[
{
"role": "user",
"content": "why can I do `let s = *boxed;` for a `Box<String>` but `let s = *rc;` on an `Rc<String>` gives \"cannot move out of an `Rc`\"? Write helpers that turn `Vec<Box<T>>` into `Vec<T>` and `Vec<Rc<T>>` into `Vec<T>`, cloning only when I actually have to."
},
{
"role": "assist... |
[
{
"role": "user",
"content": "Write a generic function that takes ownership of a list of items and a key function and returns the item with the largest key, as an owned value, with no `Clone` bound. On ties return the first one. Call the key function only once per item."
},
{
"role": "assistant",
... |
[
{
"role": "user",
"content": "implement `concat(parts: Vec<String>, sep: &str) -> String` that reuses the first string's allocation instead of building a brand new String like join() does"
},
{
"role": "assistant",
"content": "You own all the parts, so move the first `String` out and use it as t... |
[
{
"role": "user",
"content": "rotate a `[T; 3]` left by one, by value. T is not Copy, no unsafe, no clone. also want to split a `[T; 4]` into its first element and the remaining `[T; 3]`. indexing gives me \"cannot move out of type `[T; 3]`, a non-copy array\""
},
{
"role": "assistant",
"content... |
[
{
"role": "user",
"content": "I have `struct Client { conn: Option<Connection> }`. I need `disconnect(&mut self) -> Option<Connection>` to hand the connection back to the caller, `send(&mut self, msg)` that errors if not connected, and `reconnect(&mut self, new)` that returns the old one if there was one. I... |
[
{
"role": "user",
"content": "here's my code, what's wrong? I want the total and the biggest order.\n\n```rust\nfn report(orders: Vec<Order>) -> String {\n let mut total = 0;\n for o in orders {\n total += o.cents;\n }\n let biggest = orders.iter().max_by_key(|o| o.cents);\n format!(\"... |
[
{
"role": "user",
"content": "building a word index. this fails:\n\n```rust\nfor (i, word) in text.split_whitespace().enumerate() {\n let word = word.to_lowercase();\n map.insert(word, vec![i]);\n println!(\"indexed {word}\");\n}\n```\n\nuse of moved value: `word`. Also inserting overwrites the pos... |
[
{
"role": "user",
"content": "```rust\nfn route(&mut self, msg: Message) -> String {\n if msg.priority >= 5 {\n self.urgent.push(msg);\n } else {\n self.normal.push(msg);\n }\n format!(\"routed {}\", msg.id)\n}\n```\n\nwhy is this \"use of moved value\"? both branches push it but i... |
[
{
"role": "user",
"content": "I'm packing parcels into trucks with a max weight per truck. When a truck is full I `trucks.push(current)` and then keep using `current` for the next parcel, but I get \"value moved here, in previous iteration of loop\". Do I have to clone the whole truck? Write `pack(parcels: ... |
[
{
"role": "user",
"content": "I want to actually see when values get dropped after moves. Write a type that records its own drop into a shared log, and tests that demonstrate the rules: moved values drop once at the new owner, `let _ = x` vs `let _y = x`, reassignment, conditional moves, and drop order."
... |
[
{
"role": "user",
"content": "game loop question: I build the next frame's draw list while the renderer reads the current one. Right now I do `self.front = self.back.clone(); self.back.clear();` every frame because `self.front = self.back;` says \"cannot move out of `self.back` which is behind a mutable ref... |
[
{
"role": "user",
"content": "I split a CSV line into `Vec<String>` and want exactly 3 fields as owned variables. `let name = fields[0];` gives \"cannot move out of index of `Vec<String>`\", and `fields[0].clone()` everywhere feels wrong. If the count is wrong I'd like the fields back in the error."
},
... |
[
{
"role": "user",
"content": "Implement a bounded FIFO queue. `try_push` must fail when full, and on failure the caller must get their item back, since it may not be Clone and I don't want it silently dropped. Also a `force_push` that evicts the oldest."
},
{
"role": "assistant",
"content": "Whe... |
[
{
"role": "user",
"content": "```rust\nlet base = Settings::default();\nlet verbose = Settings { verbose: true, ..base };\nlet retrying = Settings { retries: 5, ..base };\n```\n\nsecond line is fine, third is \"use of partially moved value: `base`\". what? I'm not modifying base. Write me the Settings type ... |
[
{
"role": "user",
"content": "This compiles on edition 2021 but my coworker says it shouldn't. Who's right? And write something real that uses the behavior.\n\n```rust\nlet label = move || format!(\"{}\", job.name);\nsend(job.payload);\n```"
},
{
"role": "assistant",
"content": "You're right, as... |
[
{
"role": "user",
"content": "match on an enum behind &self keeps giving me E0507:\n\n```rust\nfn user(&self) -> &str {\n match *self {\n Event::Login { user } => &user,\n ...\n```\n\ncan you write the Event enum properly with: user() borrowing, describe(), rename_user(&mut self), and into_... |
[
{
"role": "user",
"content": "Write `pick<T>(items: Vec<T>, indices: &[usize]) -> Vec<Option<T>>` that moves the items at the given indices out, in the order of `indices`. T is not Clone. Out-of-range indices and repeated indices give `None` (an item can only be taken once). I also want a version that hands... |
[
{
"role": "user",
"content": "parsing a header/body message: lines until the first blank line are `key: value` headers, everything after is the body. I loop `for line in lines` for the headers and break on the blank line, then `lines.collect()` for the body, but get \"use of moved value: `lines`\". write it... |
[
{
"role": "user",
"content": "```rust\nfn write_row<W: std::fmt::Write>(mut out: W, cells: &[&str]) -> std::fmt::Result { ... }\n\nlet mut s = String::new();\nlet w = &mut s;\nwrite_row(w, &[\"a\", \"b\"])?;\nwrite_row(w, &[\"c\", \"d\"])?; // error[E0382]: use of moved value: `w`\n```\n\n`w` is a referenc... |
Claude Haiku 5.5 Rust Distill
25,726 single-turn Rust instruction/response pairs written by Claude Haiku 5.5 sub-agents. Each response's main code block is a self-contained, std-only Rust library. That block was compiled, linted with clippy at -D warnings, and passed its own #[test]s before the example was kept.
What the validation does and doesn't guarantee
Every example passed one mechanical check (source/build.py):
- The first
```rustblock in the response is extracted aslib.rs. clippy-driver --edition 2021 --crate-type lib -D warningsmust pass (default clippy lint set).rustc --edition 2021 --test -A dead_codemust build it, and the resulting test binary must exit 0.
Toolchain: rustc 1.88.0 (6b00bc388 2025-06-23), clippy 0.1.88, edition 2021, std only (no crates). 25,788 candidates were written. All prompts are unique after whitespace and case normalization, and 62 candidates failed the check and were dropped.
What this does not cover:
- Prose was not reviewed. Nobody checked the explanations, the claims about compiler errors (error codes, quoted diagnostics), performance claims, or "this is idiomatic" assertions. Treat them as model output.
- Only the first Rust block is compiled. Later
```rustblocks, plus```textand other-language blocks (compiler output, broken "before" code, Python/C++/Go comparisons), were not checked. - Tests were written by the same model as the code. Passing them shows the code is self-consistent, not that it meets the prompt's spec.
- Nothing was run under Miri, so the
unsafeexamples were not checked for undefined behavior beyond compiling and passing their tests.
Schema
rust.jsonl has one JSON object per line:
{"messages": [{"role": "user", "content": "..."}, {"role": "assistant", "content": "..."}]}
Every row is exactly one user turn followed by one assistant turn. There are no system prompts and no multi-turn conversations. Median lengths are 200 characters for prompts and 2,487 for responses (max 12,284).
Example (the shortest row, truncated):
{"messages": [{"role": "user", "content": "generic halve that works for both ints and floats without two impls. i want to write halve(x) and it just works for i32, u64, f32. whats the trait bound"}, {"role": "assistant", "content": "Key insight: `From<u8>` gives you a way to build the constant `2` for any numeric type, so one bound covers integers and floats.\n\n```rust\nuse std::ops::Div;\n\npub fn halve<T>(x: T) -> T\nwhere\n T: Div<Output = T> + From<u8>,\n{\n x / T::from(2)\n}\n..."}]}
from datasets import load_dataset
ds = load_dataset("Neppkun/claude-haiku-5.5-Rust-Distill", split="train")
How it was generated
- Topics: a fixed list of 260 Rust topics (table below), covering ownership and lifetimes, traits and generics, iterators, error handling, collections, smart pointers, concurrency, async internals, unsafe, macros, I/O, algorithms and data structures, parsers and interpreters, application-style designs, cross-language translation, code review, and performance.
- Two modes per topic, with one agent per (topic, mode) slot writing 50 examples in two files of 25:
a: implementation. "Write/implement/design X" requests. The target spread was about 25% beginner, 45% intermediate, and 30% advanced.b: debug/review/explain. The user pastes broken or unidiomatic code, or asks for a review, refactor, optimization, translation from another language, or a concept explanation. The response diagnoses the problem and gives corrected, complete code.
- Prompt voice was deliberately varied: terse, casual lowercase, detailed specs, occasional typos, and "here's my code, what's wrong".
- Response shape: the key insight first, then the code, then short notes on the non-obvious points.
- Agents were told to write from their own knowledge, without web search or existing datasets, and to use only APIs that are stable in Rust 1.88. Each agent ran
build.py --checkon its own files and fixed or removed failures. The finalbuild.pyrun then revalidated everything together. - Fill-in: 9
*_fill.txtfiles (103 kept rows) top up slots whose first pass came up short.batch_0001.txtholds 12 seed examples that set the format and quality bar.
Known gaps and quirks
- Missing slots:
195_b(floating point pitfalls, debug mode) and196_a(fixed-point decimal arithmetic for money, implementation mode) have no examples. - Short slots:
202_b(5),241_b(15),210_b(25),251_b(25),192_a(34),112_b(43),136_a(45),182_b(45). These have between 46 and 49:059_a,101_b,167_b,017_a,043_b,181_b,257_a,030_b,058_b,214_a,235_a,017_b,018_a,026_a,049_a,088_b,090_b,101_a,111_b,184_a,184_b,244_b. - Over-full slots:
168_b(64) and247_b(56). - Broken prompts are intentional. Many debug-mode prompts contain code that doesn't compile, has logic bugs, or has typos. Only responses were validated. Don't filter prompts on "does this compile".
- No reasoning traces. Responses are final answers only. Chat templates that wrap assistant turns in thinking tags, such as Granite's, render them with an empty
<think></think>. - Topic and mode balance is approximate (see counts). Coverage is limited to the fixed topic list, and some topics overlap (for example, #4/#5 on lifetimes and #251 on common compiler errors).
Re-validating
source/ contains the raw batch_*.txt files and build.py. You need rustc and clippy-driver on PATH (ideally 1.88; newer clippy versions add lints, so some examples may start failing).
cd source
python build.py # revalidate everything, rewrite source/rust.jsonl
python build.py --check batch_042_a_1.txt # check specific files, write nothing
The raw file format:
@@@ PROMPT
...
@@@ RESPONSE
...
@@@ END
File names are batch_<topic>_<mode>_<part>.txt. Topic is the 1-based index in the table below and mode is a or b. Files ending in _fill and .partN belong to the same slot.
License and terms
The dataset is released under CC-BY-4.0. The content was generated with an Anthropic model. If you train on it, you are responsible for complying with Anthropic's usage policies and terms, including the restrictions on using outputs to develop competing models.
Topics and per-slot counts
| # | Topic | a (impl) | b (debug/review) |
|---|---|---|---|
| 1 | move semantics and use-after-move errors (E0382) | 50 | 50 |
| 2 | borrowing rules and fixing E0502/E0499 | 50 | 50 |
| 3 | Clone vs Copy and when to derive them | 50 | 50 |
| 4 | references stored in structs and lifetime annotations | 50 | 50 |
| 5 | lifetime elision rules | 50 | 50 |
| 6 | 'static bounds vs owned data | 50 | 50 |
| 7 | non-lexical lifetimes and two-phase borrows edge cases | 50 | 50 |
| 8 | returning references from functions | 50 | 50 |
| 9 | borrowing inside loops and closures | 50 | 50 |
| 10 | std::mem::take, replace and swap | 50 | 50 |
| 11 | Option<&mut T>, as_mut, as_ref, as_deref | 50 | 50 |
| 12 | partial moves and destructuring | 50 | 50 |
| 13 | reborrowing &mut and passing &mut through functions | 50 | 50 |
| 14 | drop order and scopes | 50 | 50 |
| 15 | RAII guards via Drop | 50 | 50 |
| 16 | structs, tuple structs and newtypes | 50 | 50 |
| 17 | enums carrying data and exhaustive match | 47 | 49 |
| 18 | advanced pattern matching: guards, @ bindings, ranges, slice patterns | 49 | 50 |
| 19 | let-else and early returns | 50 | 50 |
| 20 | trait definitions and default methods | 50 | 50 |
| 21 | generic functions with trait bounds and where clauses | 50 | 50 |
| 22 | associated types vs generic type parameters | 50 | 50 |
| 23 | associated consts | 50 | 50 |
| 24 | blanket impls | 50 | 50 |
| 25 | the orphan rule and the newtype workaround | 50 | 50 |
| 26 | trait objects and dyn compatibility | 49 | 50 |
| 27 | supertraits | 50 | 50 |
| 28 | operator overloading (Add, Sub, Mul, Neg, Index, IndexMut, AddAssign) | 50 | 50 |
| 29 | implementing PartialEq/Eq/PartialOrd/Ord/Hash correctly | 50 | 50 |
| 30 | Display and Debug impls and formatter flags (width, precision, alternate) | 50 | 48 |
| 31 | From/Into/TryFrom/TryInto conversions | 50 | 50 |
| 32 | AsRef, Borrow and Deref | 50 | 50 |
| 33 | FromStr and str::parse | 50 | 50 |
| 34 | Default and the builder pattern | 50 | 50 |
| 35 | Send, Sync and PhantomData | 50 | 50 |
| 36 | Sized, ?Sized and dynamically sized types | 50 | 50 |
| 37 | impl Trait in argument and return position | 50 | 50 |
| 38 | generic associated types (GATs) | 50 | 50 |
| 39 | const generics | 50 | 50 |
| 40 | the sealed trait pattern | 50 | 50 |
| 41 | extension traits | 50 | 50 |
| 42 | implementing Iterator for custom types | 50 | 50 |
| 43 | IntoIterator for owned, & and &mut collections | 50 | 47 |
| 44 | DoubleEndedIterator and ExactSizeIterator | 50 | 50 |
| 45 | the typestate pattern | 50 | 50 |
| 46 | iterator adaptors: map, filter, fold, for_each | 50 | 50 |
| 47 | zip, chain, enumerate, windows, chunks | 50 | 50 |
| 48 | collect into different collections and FromIterator | 50 | 50 |
| 49 | iterator laziness and performance | 49 | 50 |
| 50 | closures: Fn, FnMut, FnOnce | 50 | 50 |
| 51 | returning and boxing closures | 50 | 50 |
| 52 | move closures and what they capture | 50 | 50 |
| 53 | Peekable and iterator-driven parsing | 50 | 50 |
| 54 | scan, take_while, skip_while, step_by, map_while | 50 | 50 |
| 55 | flat_map and flatten | 50 | 50 |
| 56 | sum, product, min_by_key, max_by, reduce | 50 | 50 |
| 57 | custom iterator adaptors via extension traits | 50 | 50 |
| 58 | Result and the ? operator | 50 | 48 |
| 59 | custom error enums | 46 | 50 |
| 60 | Box and error source chains | 50 | 50 |
| 61 | Option combinators (map, and_then, filter, unwrap_or_else, zip, take) | 50 | 50 |
| 62 | converting between Option and Result (ok_or, ok, transpose) | 50 | 50 |
| 63 | panics vs recoverable errors, unwrap/expect policy | 50 | 50 |
| 64 | adding context to errors without external crates | 50 | 50 |
| 65 | main returning Result and process exit codes | 50 | 50 |
| 66 | catch_unwind and unwind safety | 50 | 50 |
| 67 | parse-don't-validate and validated newtypes | 50 | 50 |
| 68 | Vec operations: capacity, retain, dedup, drain, splice, extend_from_slice | 50 | 50 |
| 69 | VecDeque | 50 | 50 |
| 70 | HashMap entry API | 50 | 50 |
| 71 | BTreeMap and range queries | 50 | 50 |
| 72 | HashSet and BTreeSet set operations | 50 | 50 |
| 73 | BinaryHeap, priority queues and Reverse | 50 | 50 |
| 74 | slice methods: sort_unstable_by_key, binary_search, partition_point, rotate, split_first | 50 | 50 |
| 75 | String vs &str, UTF-8, char_indices and byte offsets | 50 | 50 |
| 76 | string formatting and building strings efficiently | 50 | 50 |
| 77 | byte strings and u8 processing | 50 | 50 |
| 78 | arrays and fixed-size buffers | 50 | 50 |
| 79 | sorting with custom comparators, stability, sort_by_cached_key | 50 | 50 |
| 80 | Cow and clone-on-write APIs | 50 | 50 |
| 81 | grouping, frequency counting and deduplication | 50 | 50 |
| 82 | LinkedList and why Vec/VecDeque usually wins | 50 | 50 |
| 83 | Box and recursive data types | 50 | 50 |
| 84 | Rc and Weak, trees with parent pointers | 50 | 50 |
| 85 | RefCell, interior mutability and borrow panics | 50 | 50 |
| 86 | Cell | 50 | 50 |
| 87 | Arc and Mutex | 50 | 50 |
| 88 | RwLock | 50 | 49 |
| 89 | OnceCell, OnceLock and LazyLock | 50 | 50 |
| 90 | memory layout, size_of, alignment and niche optimization | 50 | 49 |
| 91 | arena allocation with indices instead of pointers | 50 | 50 |
| 92 | graph representations without Rc | 50 | 50 |
| 93 | reference cycles and memory leaks | 50 | 50 |
| 94 | Pin basics | 50 | 50 |
| 95 | thread::spawn and join handles | 50 | 50 |
| 96 | scoped threads with thread::scope | 50 | 50 |
| 97 | channels: mpsc and sync_channel backpressure | 50 | 50 |
| 98 | Mutex poisoning | 50 | 50 |
| 99 | Condvar | 50 | 50 |
| 100 | atomics and memory ordering | 50 | 50 |
| 101 | Barrier | 49 | 46 |
| 102 | building a thread pool with std only | 50 | 50 |
| 103 | deadlock avoidance and lock ordering | 50 | 50 |
| 104 | Send/Sync compiler errors and how to fix them | 50 | 50 |
| 105 | producer-consumer pipelines | 50 | 50 |
| 106 | parallel map-reduce with std | 50 | 50 |
| 107 | thread_local! | 50 | 50 |
| 108 | spin loops, std::hint::spin_loop and backoff | 50 | 50 |
| 109 | lock-free data structures with atomics | 50 | 50 |
| 110 | the Future trait and implementing a Future by hand | 50 | 50 |
| 111 | a minimal single-threaded executor with Waker | 50 | 49 |
| 112 | how async/await desugars | 50 | 43 |
| 113 | Pin and self-referential futures | 50 | 50 |
| 114 | async fn in traits | 50 | 50 |
| 115 | raw pointers and SAFETY comments | 50 | 50 |
| 116 | MaybeUninit | 50 | 50 |
| 117 | unsafe impl Send/Sync | 50 | 50 |
| 118 | slice::from_raw_parts and pointer arithmetic | 50 | 50 |
| 119 | implementing a Vec-like container with std::alloc | 50 | 50 |
| 120 | extern "C" functions and repr(C) | 50 | 50 |
| 121 | transmute pitfalls and safe alternatives | 50 | 50 |
| 122 | UnsafeCell | 50 | 50 |
| 123 | aliasing rules and undefined behavior Miri would catch | 50 | 50 |
| 124 | NonNull and variance | 50 | 50 |
| 125 | macro_rules basics | 50 | 50 |
| 126 | macro repetition and recursion | 50 | 50 |
| 127 | macro hygiene and $crate | 50 | 50 |
| 128 | tt-muncher macros | 50 | 50 |
| 129 | macros that generate trait impls | 50 | 50 |
| 130 | debugging and testing macros | 50 | 50 |
| 131 | the module system and visibility (pub(crate), pub(super)) | 50 | 50 |
| 132 | doc comments and doctests | 50 | 50 |
| 133 | unit tests, #[should_panic] and test organization | 50 | 50 |
| 134 | property-style randomized testing without crates | 50 | 50 |
| 135 | micro-benchmarking with Instant and black_box | 50 | 50 |
| 136 | cfg attributes and conditional compilation | 45 | 50 |
| 137 | Rust API design guidelines and naming conventions | 50 | 50 |
| 138 | semver and what counts as a breaking change | 50 | 50 |
| 139 | reading files with BufReader and lines | 50 | 50 |
| 140 | writing files with BufWriter and flushing | 50 | 50 |
| 141 | generic code over Read and Write | 50 | 50 |
| 142 | parsing std::env::args by hand | 50 | 50 |
| 143 | Path and PathBuf | 50 | 50 |
| 144 | std::process::Command | 50 | 50 |
| 145 | TcpListener and TcpStream | 50 | 50 |
| 146 | UdpSocket | 50 | 50 |
| 147 | Duration, Instant and SystemTime | 50 | 50 |
| 148 | reading interactive input from stdin | 50 | 50 |
| 149 | binary search and its variants | 50 | 50 |
| 150 | two-pointer techniques | 50 | 50 |
| 151 | sliding window algorithms | 50 | 50 |
| 152 | prefix sums and difference arrays | 50 | 50 |
| 153 | implementing merge sort and quicksort | 50 | 50 |
| 154 | binary heaps from scratch and heap sort | 50 | 50 |
| 155 | BFS on grids | 50 | 50 |
| 156 | DFS, recursion vs explicit stacks | 50 | 50 |
| 157 | Dijkstra's algorithm | 50 | 50 |
| 158 | topological sort | 50 | 50 |
| 159 | union-find / disjoint set | 50 | 50 |
| 160 | minimum spanning trees (Kruskal, Prim) | 50 | 50 |
| 161 | 1D dynamic programming | 50 | 50 |
| 162 | 2D dynamic programming (edit distance, LCS) | 50 | 50 |
| 163 | knapsack variants | 50 | 50 |
| 164 | memoization with HashMap | 50 | 50 |
| 165 | backtracking (permutations, subsets, n-queens, sudoku) | 50 | 50 |
| 166 | bit manipulation | 50 | 50 |
| 167 | number theory: gcd, modular exponentiation, sieve | 50 | 46 |
| 168 | arbitrary-precision integer arithmetic by hand | 50 | 64 |
| 169 | string search: KMP and Z-algorithm | 50 | 50 |
| 170 | tries | 50 | 50 |
| 171 | segment trees | 50 | 50 |
| 172 | Fenwick trees | 50 | 50 |
| 173 | LRU cache | 50 | 50 |
| 174 | merging and querying intervals | 50 | 50 |
| 175 | matrix operations | 50 | 50 |
| 176 | computational geometry basics | 50 | 50 |
| 177 | pseudo-random number generators (xorshift, PCG, splitmix) | 50 | 50 |
| 178 | hashing: FNV and custom Hasher/BuildHasher | 50 | 50 |
| 179 | bloom filters | 50 | 50 |
| 180 | rolling hashes and Rabin-Karp | 50 | 50 |
| 181 | Bellman-Ford and Floyd-Warshall | 50 | 47 |
| 182 | greedy algorithms | 50 | 45 |
| 183 | combinatorics with overflow checks | 50 | 50 |
| 184 | checked, wrapping, saturating and overflowing arithmetic | 49 | 49 |
| 185 | floating point pitfalls and f64::total_cmp | 50 | 50 |
| 186 | fixed-point decimal arithmetic for money | 50 | 50 |
| 187 | cycle detection in graphs and linked structures | 50 | 50 |
| 188 | singly linked lists in safe Rust | 50 | 50 |
| 189 | binary trees with Option<Box> | 50 | 50 |
| 190 | binary search tree insert, delete and traversal | 50 | 50 |
| 191 | writing a lexer/tokenizer | 50 | 50 |
| 192 | recursive descent parsers | 34 | 50 |
| 193 | Pratt parsing for expressions | 50 | 50 |
| 194 | ASTs with enums and Box | 50 | 50 |
| 195 | tree-walking interpreters | 50 | 0 |
| 196 | bytecode virtual machines | 0 | 50 |
| 197 | a JSON parser by hand | 50 | 50 |
| 198 | CSV parsing with quoting | 50 | 50 |
| 199 | INI / TOML-subset config parsers | 50 | 50 |
| 200 | command-line argument parsers by hand | 50 | 50 |
| 201 | glob and wildcard matching | 50 | 50 |
| 202 | state machines for protocol parsing | 50 | 5 |
| 203 | binary format parsing with from_be_bytes/from_le_bytes | 50 | 50 |
| 204 | URL parsing | 50 | 50 |
| 205 | date and time parsing and validation | 50 | 50 |
| 206 | bank account simulation with enforced invariants | 50 | 50 |
| 207 | inventory and order systems | 50 | 50 |
| 208 | event sourcing | 50 | 50 |
| 209 | entity-component-system game architecture | 50 | 50 |
| 210 | Conway's game of life and cellular automata | 50 | 25 |
| 211 | text adventure / game state modeling | 50 | 50 |
| 212 | vector and matrix math libraries | 50 | 50 |
| 213 | units of measure with newtypes | 50 | 50 |
| 214 | token-bucket rate limiters | 48 | 50 |
| 215 | retry with exponential backoff | 50 | 50 |
| 216 | caches with TTL expiry | 50 | 50 |
| 217 | key-value store with a write-ahead log | 50 | 50 |
| 218 | log parsing and aggregation | 50 | 50 |
| 219 | text wrapping and justification | 50 | 50 |
| 220 | diff algorithms | 50 | 50 |
| 221 | task schedulers and priority queues | 50 | 50 |
| 222 | observer pattern and callbacks | 50 | 50 |
| 223 | plugin registries with trait objects | 50 | 50 |
| 224 | dependency injection via generics and traits | 50 | 50 |
| 225 | state machines (vending machine, traffic light, TCP states) | 50 | 50 |
| 226 | bitflags implemented by hand | 50 | 50 |
| 227 | strongly typed IDs with newtypes | 50 | 50 |
| 228 | image processing on pixel buffers | 50 | 50 |
| 229 | audio sample processing | 50 | 50 |
| 230 | compression: RLE, LZ77, Huffman coding | 50 | 50 |
| 231 | refactoring C-style index loops into idiomatic Rust | 50 | 50 |
| 232 | translating Python code to Rust | 50 | 50 |
| 233 | translating C++ code to Rust (RAII, templates, inheritance) | 50 | 50 |
| 234 | translating Go code to Rust (errors, goroutines, interfaces) | 50 | 50 |
| 235 | code review: unnecessary clones and allocations | 48 | 50 |
| 236 | code review: unwrap overuse and error handling | 50 | 50 |
| 237 | code review: &str vs String, &[T] vs &Vec in parameters | 50 | 50 |
| 238 | performance: avoiding allocations in hot paths | 50 | 50 |
| 239 | performance: cache-friendly data layout (struct of arrays) | 50 | 50 |
| 240 | common clippy lints and why they matter | 50 | 50 |
| 241 | common compiler errors: E0382, E0505, E0597, E0716, E0106 | 50 | 15 |
| 242 | lifetime errors with closures and threads | 50 | 50 |
| 243 | reading and fixing trait bound errors | 50 | 50 |
| 244 | type inference failures and the turbofish | 50 | 49 |
| 245 | integer casting: as vs try_from, overflow | 50 | 50 |
| 246 | shadowing, mutability, const vs static | 50 | 50 |
| 247 | naming and documentation conventions | 50 | 56 |
| 248 | edition differences (2015, 2018, 2021, 2024) | 50 | 50 |
| 249 | Rust concepts compared with other languages | 50 | 50 |
| 250 | explaining Rust fundamentals to beginners | 50 | 50 |
| 251 | generic sorting and searching over T: Ord | 50 | 25 |
| 252 | Hash consistency with Eq and custom Hash impls | 50 | 50 |
| 253 | zero-cost abstractions and what compiles to what | 50 | 50 |
| 254 | enum dispatch vs dyn dispatch | 50 | 50 |
| 255 | iterator-based text processing (word counts, n-grams) | 50 | 50 |
| 256 | deep recursion and avoiding stack overflow | 50 | 50 |
| 257 | mutating Option<Box> linked structures | 47 | 50 |
| 258 | generic numeric code with traits | 50 | 50 |
| 259 | hand-written binary serialization and deserialization | 50 | 50 |
| 260 | math puzzles and simulations (Project Euler style) | 50 | 50 |
Plus 12 seed examples from batch_0001.txt.
- Downloads last month
- 1,167