Improve documentation examples and streamline architecture support#53
Open
phip1611 wants to merge 7 commits intorust-osdev:mainfrom
Open
Improve documentation examples and streamline architecture support#53phip1611 wants to merge 7 commits intorust-osdev:mainfrom
phip1611 wants to merge 7 commits intorust-osdev:mainfrom
Conversation
Member
phip1611
commented
Mar 23, 2026
- Split backend into mmio.rs (always) and pio.rs (x86-only) to localize cfg usage at module boundaries
- Introduced cfg_aliases (x86) to remove repetition and improve readability
- Switched to #[cfg(any(x86, doc))] so rustdoc includes all items across architectures
- Enabled doc_cfg on docs.rs for proper platform-specific annotations
- Removed cfg_attr(doc = ...) string workarounds in favor of proper intra-doc links
- No functional changes; purely improves structure, maintainability, and documentation
- dedicated example for x86 port IO and MMIO - also builds on non-x86 systems
This adds badges on docs.rs that show that a specific item is just available on the configured architecture. We now can also meaningfully build the complete rustdoc on any platform.
Removes lots of duplication.
This helps massive duplication of #[cfg] attributes.
phip1611
commented
Mar 23, 2026
|
|
||
| fn main() { | ||
| // SAFETY: The port is valid and we have exclusive access. | ||
| let mut uart = unsafe { Uart16550Tty::new_mmio(0x3f8, Config::default()).expect("should initialize device") }; |
phip1611
commented
Mar 23, 2026
|
|
||
| mod mmio; | ||
| #[cfg(any(x86, doc))] | ||
| mod pio; |
Member
Author
There was a problem hiding this comment.
Todo I need to check if the docs.rs badges will still appear if the gate is just in the module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.