Is there a way for showing private structs/methods documentation?


I know that the documentation should be only used for libraries, and in public interfaces (at least when compiling it for public use) or in the main module in an executable so that people can know how to use it (even though it includes all the dependency documentation).

But I think it could be a great idea to be able to document private methods too, I’m thinking in some sort of dev-docs, so that doing cargo doc --dev or something similar we could generate all documentation (with visibility information too). We could have some lint similar to #[warn(missing_docs)] for warning on undocumented private methods. I guess there is no option currently.

This could be really benefitial for people wanting to contribute in the library/program to learn about its internals. It’s not always about using it, but sometimes about developing for it. What do you think? should I create a topic in the Internals forum? Is this even useful for more people than myself :sweat_smile:?


It’s possible now (though not perfect):

cargo rustdoc -- --no-defaults --passes collapse-docs --passes unindent-comments

There’s more discussion in this issue


I found that we also have this issue open: #1520, let’s hope it gets accepted!