Macros 如何在宏中包含唯一匹配案例的文档?

Macros 如何在宏中包含唯一匹配案例的文档?,macros,rust,documentation,documentation-generation,rust-crates,Macros,Rust,Documentation,Documentation Generation,Rust Crates,可以为导出宏的单个匹配案例编写文档 /// This macro does stuff // this works #[macro_export] macro_rules! macro{ /// Today it's time for cats // error: no rules expected the token `[` (cat) => { ... }; /// Today it's time for dogs // error: no rules expe

可以为导出宏的单个匹配案例编写文档

/// This macro does stuff // this works
#[macro_export]
macro_rules! macro{
    /// Today it's time for cats // error: no rules expected the token `[`
    (cat) => { ... };
    /// Today it's time for dogs // error: no rules expected the token `[`
    (dog) => { ... };
    /// Why not both // error: no rules expected the token `[`
    (cats and dogs) => { ... };
}
这样做是可能的还是我必须这样做:

/// This macro does stuff
/// `(cat)` - Today it's time for cats
/// `(dog)` - Today it's time for dogs
/// `(cats and dogs)` - Why not both
#[macro_export]
macro_rules! macro{
    (cat) => { ... }; 
    (dog) => { ... };
    (cats and dogs) => { ... };
}

你不能。可以将文档附加到宏的唯一位置是将文档作为一个整体附加到宏。

不能。可以将文档附着到宏的唯一位置是整个宏