Ask
54
@rust_rescue_rin ·

The Book or Programming Rust for a second pass — which one made ownership click for you?

I have read the official book once end to end and I can write code that compiles, but I am pattern matching on error messages rather than understanding what I am doing. Cloning things until the compiler stops complaining is my actual strategy. I have 45 minutes a day and I am choosing between Programming Rust, Rust for Rustaceans, or just rereading the book more slowly. Which one actually changed how you think rather than adding more syntax?

8 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @hot_heap_hana · 6mo ago · 3 replies

    I own all three and they solve different problems. The official book is a tutorial, it optimises for getting you productive and deliberately underexplains the model. Programming Rust is a reference sized explanation and its chapters on ownership, moves and references are the ones that made the model actually snap into place for me, because it explains what the compiler is protecting you from rather than which incantation satisfies it. Rust for Rustaceans is excellent and completely wrong for you right now, it assumes you already have the model and want the edges. Programming Rust, chapters four and five, slowly.

    61
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @rust_rescue_rin · 6mo ago

      Cloning until it compiles is exactly what I do, so what the compiler is protecting me from is precisely the gap. Ordering it.

      18
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
    • @proof_pilar · 6mo ago

      Same order worked for me, and I would add: read those two chapters twice with a week between rather than reading the rest of the book once.

      24
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @four_percent_fi · 6mo ago · 2 replies

    Respectfully, no book taught me ownership, a project did. What broke it open was writing something with a real data structure that outlives a function, because the toy examples in every book have lifetimes that are obvious and the pain starts exactly where the examples stop. The linked list tutorial that walks you through building lists in Rust badly, over and over, and explains why each attempt fails, taught me more in a weekend than any chapter. Books after that read completely differently.

    57
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @hot_heap_hana · 6mo ago

      I would put these in sequence rather than in opposition. The linked list walk is brutal without a mental model to hang it on, and it is superb once you have one.

      26
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @airgap_amir · 6mo ago

    Whatever you read, do the rustlings exercises alongside it. They are small, they fail loudly, and they cover exactly the ownership cases that reading lets you skim past. It is the cheapest way I know to find out whether you actually understood a chapter.

    31
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @cors_error_cleo · 6mo ago

    My mistake was reading three books before writing anything of my own. I had opinions about trait objects and could not build a CLI that read a file without going back to the docs, and I lost most of a winter to it. Forty five minutes a day should be thirty minutes writing and fifteen reading, not the other way round.

    44
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @proof_pilar · 6mo ago

    Programming Rust chapters four and five, then stop reading and port something you already wrote in another language. The second time through the borrow checker you will notice it is telling you about your design, not your syntax.

    36
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report