🦀 Your First Rust Docs Page: Hello, World! Style

So you just started learning Rust and want your code to look pro? Let’s write a Hello, World! that’s not just code—it’s documented code.


✨ Step 1: Make a New Project

Open your terminal and type:

bash
Loading…

✍️ Step 2: Add Some Friendly Docs

Open src/lib.rs and use this:

rust
Loading…

🔍 Step 3: See the Magic

bash
Loading…

✅ Bonus: Make It Run

Edit src/main.rs:

rust
Loading…

And in Cargo.toml:

toml
Loading…

💡 Tips for Writing Docs

  • Use //! for crate docs
  • Use /// for functions
  • Show examples with triple backticks
  • Be clear and friendly