Description
Context
Often, the internal parts of a crate have their own documentation, even if they're not exposed as part of the public API. It can be pretty useful to be able to have a rendered version of that documentation for reference and development purposes:
- the doc comments are rendered as text in a way that may be nicer to read;
- the docs are linkable, making it easy to share references to specific items' docs with collaborators;
- the rustdoc interface can show highlights of the internal structure (e.g., all trait implementations in one place);
- the internal documentation may be of independent interest.
For instance, a bunch of notes on the internal details of a crypto implementation I wrote are kept in documentation for internal modules, hosted separately from the "external" docs. Although that's probably an extremal example in terms of "effort put into documentation of private items", I think this would still be useful ecosystem-wide.
Proposal
docs.rs could render documentation for all crates twice, once as normal and once with --document-private-items
, then host a second copy of the documentation for all crates under a different URL. Each set of docs would link internally to itself, so following links in the "public" section would remain in the "public" section, and following links in the "private" section would remain in the "private" section.
I'm not attached to this in particular, but my suggestion would be to place all private docs on a separate subdomain, say private.docs.rs
, with an identical URL structure to the "public" docs.rs
. The advantage of this choice is that:
- it's really easy to switch between internal and external docs by adding or removing the subdomain;
- it's clear from looking at the URL bar which version you're seeing, even if the full path is too long to display.