Improve documentation examples and streamline architecture support#53
Improve documentation examples and streamline architecture support#53phip1611 merged 6 commits intorust-osdev:mainfrom
Conversation
| //! - [`MmioBackend`] | ||
|
|
||
| mod mmio; | ||
| #[cfg(any(target_arch = "x86", target_arch = "x86_64", doc))] |
5294752 to
dcea221
Compare
This helps to reduce #[cfg()] duplication.
- cfg badges per item - needs nightly - comes with auto-detection of cfg items, so there is no need for `#[doc(cfg(...))]` per item To verify, run: RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --open --no-deps
aa5bb4d to
09fbd20
Compare
- dedicated example for x86 port IO and MMIO - also builds on non-x86 systems To test doc cross-build, you may use RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --open --no-deps --document-private-items --target aarch64-unknown-linux-gnu -Zbuild-std
|
Yikes this was more painful than anticipated but I've learned something about cross-architecture rustdoc builds :D |
mkroening
left a comment
There was a problem hiding this comment.
Splitting into modules definitely makes sense. 👍
The second commit does not seem to do what it says. 🤔
- Switched to #[cfg(any(x86..., doc))] so rustdoc includes all items across architectures
Why is this useful? I have never seen a crate do this. Instead, you can switch the platform on docs.rs.
Do you refer to an old commit? 🤔 I'm not sure which one you are talking about.
I did not know this 😁 interesting
TL;DR: I have a feeling that a documentation should include everything (with markers for feature gates). This is I think my first library crate with platform specific API, I think. I have no idea what the standard is. To me, it feels natural that the documentation includes everything if one reads them. e.g., if one build the documentation on their macbook and opens it, the documentation should tell the developer how they can do stuff on a x86 PC, for example. I think this is quite useful and the necessary changes to the codebase are fairly small. What do you think? Do you see any risk? |
I mean this one: 1f47a91
I think the default is to enable all features for building docs, but not all target-dependent options such as OS or architecture. If a Take, for example, If you prefer it like that, it should be fine; I was just confused at first. :D |
|
Thanks for the heads-up - I simply didn't know 😁 I think I'm in favor of keeping it the current way.
|

Uh oh!
There was an error while loading. Please reload this page.