Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Rust Fundamentals

Lesson 28 of 50 · rust

Documentation with Cargo Doc

Duration: 12 minutes

Documentation with Cargo Doc\n\nRust supports documentation comments (///). Generate docs with cargo doc.\n\nrust\n/// Adds two numbers.\n///\n/// # Examples\n///\n/// \n/// let sum = add(2, 3);\n/// assert_eq!(sum, 5);\n/// \nfn add(a: i32, b: i32) -> i32 {\n a + b\n}\n\n\nOpen the generated docs in a browser: cargo doc --open.

Previous: Writing TestsNext: Working with Files