How to generate cargo docs only for specific modules?

I am adding doc comments to a project and I want to run cargo doc periodically and examine the generated HTML. But I'm not able to run a cargo command that regenerates docs only for my project, or for specific modules within it.

I do not want to run a full cargo doc each time as that takes too long. But when I run cargo doc --no-deps the changes I made are not getting reflected in the generated HTML. Is there a way to generate documentation for modules or folders within my project?

When you run cargo doc --no-deps all your changes should be there, unless you've edited a dependency instead of the main crate, or edited files that aren't currently part of the library (e.g. a file that isn't picked by any mod declaration).

You can't generate docs for an individual module. You can generate docs for a specific package/crate: cargo doc -p crate-name.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.