Skip to content

rust_std: an interactive course in standard Rust, with zero dependencies - #1

Merged
Divhanthelion merged 9 commits into
mainfrom
claude/youthful-pasteur-oguvf3
Oct 1, 2026
Merged

Divhanthelion merged 9 commits into
mainfrom
claude/youthful-pasteur-oguvf3

Conversation

@Divhanthelion

Copy link
Copy Markdown
Owner

Summary

A command-line course that teaches Rust using only the standard library. The crate has no dependencies. It has 41 lessons in eight parts, 315 live demos, 208 quiz questions, and exercises at the end of every lesson.

cargo run --release              # interactive menu
cargo run --release -- learn 6   # step through Ownership
cargo run --release -- quiz      # 15 random review questions

Curriculum

  • I. Foundations: formatting, bindings, numbers and overflow policies, tuples/arrays/slices, functions and control flow.
  • II. Ownership & borrowing: moves, Drop order, the aliasing rule, strings and UTF-8, lifetimes (variance, HRTBs).
  • III. Modeling data: structs and repr, enums, every pattern form (let chains, let-else), Option/Result, error handling.
  • IV. Abstraction: generics and const generics, traits and dyn, the standard traits and operators, closures, iterators.
  • V. The standard library: collections, smart pointers, modules, threads, atomics and memory ordering, I/O and processes, a tour of std.
  • VI. Advanced Rust: macro_rules!, testing, advanced types (DSTs, niches, Pin, GATs), and async from scratch with a hand-rolled executor.
  • VII. Systems & automotive: bytes and bits with a compile-time CRC table, CAN frame parsing (Intel/Motorola signals, OBD-II), allocation-free containers, typestate (ignition, UDS security access), panic freedom, unsafe and FFI against real libc, core/alloc/std, vehicle concurrency patterns, and safety-critical context (ISO 26262, E2E protection, 2-of-3 voting).
  • VIII. Career: an interview clinic with whiteboard implementations, and a capstone: a multi-threaded CAN signal gateway.

How it works

  • Lessons are static data. Each code sample is a real function in the lesson's own file. The CLI cuts it out by // ANCHOR: markers, highlights it, and runs it, so shown code and output can't drift apart.
  • The machinery uses std only: argument parsing, a Markdown-style renderer, a Rust syntax highlighter, an xorshift PRNG, file-based progress, and a counting global allocator.

Verification

  • tests/prose_examples.rs compiles every rust block in the lesson text. It also checks that each of the 26 compile_fail blocks fails with the error code it claims (E0382, E0499, E0502, E0597, …).
  • Registry tests check that every lesson file is registered, every anchor exists and is shown, every quiz is well-formed, and every demo runs without panicking. tests/cli.rs renders every lesson through the real binary and drives the interactive menu, quiz and progress file.
  • CI runs fmt and clippy (-D warnings), plus tests on Linux, macOS and Windows for stable and Rust 1.95. That pins the declared rust-version; 1.94 lacks cfg_select!.

Notes

  • main holds a single empty "Initial commit", because the repository started empty and a PR needs a base branch.
  • No license is included yet, and Cargo.toml sets publish = false. The license is the owner's choice.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7


Generated by Claude Code

claude added 9 commits October 1, 2026 01:56
A lib+bin crate with zero dependencies: lessons are static data whose code
samples are real functions cut out of the lesson's own source by anchor,
displayed with a small highlighter and executed live. Includes a CLI with an
interactive menu, quizzes, search and file-based progress, plus tests that
compile every prose example and check compile_fail blocks fail as claimed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
…rators

Also guard the lesson registry with tests: every lesson file must be
registered and every code region must be shown by a section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
…omics, I/O, std tour

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
Bytes and bits, CAN frame parsing (text, SocketCAN layout, Intel/Motorola
signals, OBD-II, fuzzing), allocation-free containers measured with a
counting global allocator, typestate, panic freedom, unsafe and FFI against
real libc functions, core/alloc/std layering, vehicle concurrency patterns,
and safety-critical context with plausibility, voting and E2E protection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
- Interview clinic: model answers, predict-the-output drills, and
  whiteboard classics (two-stack queue, linked list, O(1) LRU, array and
  string problems).
- Capstone: a multi-threaded CAN signal gateway built from earlier
  lessons' parts, behind a typestate API, with fuzz and allocation checks.
- Quiz choices are now shuffled at display time; most answers were 'b'.
- List view aligns to the longest title.
- rust-version set to 1.95 (verified: cfg_select! needs it; the full
  suite passes on 1.95 and 1.97).
- README with commands, generated curriculum, study paths and layout.
- GitHub Actions: fmt + clippy, and tests on Linux/macOS/Windows for
  stable and 1.95.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
Teach as_chunks::<N>() instead of chunks_exact with a constant size, mark
the deferred-initialization demo as intentional, and move CI to
actions/checkout@v5 (Node 20 deprecation).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UkYbwHpY9bywefAyqBSch7
@Divhanthelion
Divhanthelion merged commit 3710272 into main Oct 1, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants