Simplify docs.rs documentation and build whole API#181
Simplify docs.rs documentation and build whole API#181hannobraun wants to merge 2 commits intojamesmunns:mainfrom
docs.rs documentation and build whole API#181Conversation
This made `docs.rs` set a specific cfg flag when building documentation, but that flag isn't used anywhere. I figure, simpler is better, so let's remove it.
The current documentation on `docs.rs` is lacking a lot of API surface. Always enabling all features should fix this, and prevent it from happening in the future. Please note that I don't have a way to test this, so I can't guarantee it'll work. But the documentation currently builds with all features (which is verified in [jamesmunns#178]), and the documentation on `docs.rs` metadata seems clear enough: https://docs.rs/about/metadata [jamesmunns#178]: jamesmunns#178
| documentation = "https://docs.rs/cobs-acc/" | ||
|
|
||
| [package.metadata.docs.rs] | ||
| rustdoc-args = ["--cfg", "docsrs"] |
There was a problem hiding this comment.
I think this is used for gating some kind of docs-rs feature display
and https://github.com/jamesmunns/postcard/blob/bee7f0f965362e4ac687a2721d81f916e78735b1/source/postcard/src/lib.rs#L75-L106 are examples
I don't entirely recall how this works though, I probably copy and pasted it from postcard or similar.
Tho looking at https://github.com/jamesmunns/postcard/pull/108/files, we might be missing the second half of this, e.g. #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]. I'd prefer to keep this in and actually go fix the other missing half.
There was a problem hiding this comment.
Ah, okay, I didn't consider that it actually should be used. I just saw that it isn't, and figured its some copy/paste remnant 😅
I'll look into this! But first, I'd like to dump some research here, so there's a more complete picture for later reference.
- Here's the documentation of
#[doc]: https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html - Thought the
doc(cfg(syntax is unstable, documented separately: https://doc.rust-lang.org/unstable-book/language-features/doc-cfg.html - And it seems that
docs.rsis using nightly to build documentation, which is why that works.
|
I started looking into how to do this properly, but hit an obstacle that goes a bit beyond what I want to invest in this pull request right now. I'll document my approach and the obstacle here, in case anybody wants to pick up where I left off. Here's the configuration I added to This should make sure that documentation is generated for all code, and sets the stage for also documenting which features need to be enabled, as per the comments in this review. To test my changes, I was trying to use this command, to mimick what In theory, this should generate the full documentation, but without any information about features. From here, you could start documenting the features (again, as per these comments), as required. However, when running the above command, I get an error: This is a bit more than I want to get into right now, so I've opened tosc-rs/scoped-mutex#26 and will leave it at that. I recommend merging this pull request as-is and open an issue to track further improvements, for these reasons:
|
Currently, a lot of the API surface is missing from the documentation on
docs.rs.Please note that I can't verify that this works. From the message of one of the commits: