module!() { /* proc-macro */ }Expand description
§Read module documentation from Rust source files.
ⓘ
//! # Overall module documentation
#![doc = read_doc::module!("submodule1.rs", "submodule2.rs")]
mod submodule1;
mod submodule2;This macro extracts inner doc comments from the passed Rust source files and
combines them into a string that can be used with #[doc = ...].
Each file’s module documentation will be separated by a blank line.
Paths are relative to the directory containing the calling file.
§Example
Given the source files below, cargo doc will produce the following
documentation:
# Fruit functionality
This has a lot of interesting functionality.
### Apple processing
Green or red, we don't care.
### Orange processing
Various orange-related code.§/src/fruit/mod.rs
ⓘ
//! # Fruit functionality
//!
//! This has a lot of interesting functionality.
#![doc = read_doc::module!("apple.rs", "orange.rs")]
mod apple;
pub use apple::*;
mod orange;
pub use orange::*;§/src/fruit/apple.rs
//! ### Apple processing
//!
//! Green or red, we don't care.
/// Sweet or tart.
pub struct Apple;§/src/fruit/orange.rs
//! ### Orange processing
//!
//! Various orange-related code.
/// A round fruit.
pub struct Orange;