Skip to content

Improve documentation examples and streamline architecture support#53

Open
phip1611 wants to merge 7 commits intorust-osdev:mainfrom
phip1611:restructure
Open

Improve documentation examples and streamline architecture support#53
phip1611 wants to merge 7 commits intorust-osdev:mainfrom
phip1611:restructure

Conversation

@phip1611
Copy link
Member

  • 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
@phip1611 phip1611 requested a review from mkroening March 23, 2026 20:29
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.

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") };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, must be new_port


mod mmio;
#[cfg(any(x86, doc))]
mod pio;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo I need to check if the docs.rs badges will still appear if the gate is just in the module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant