0

Es ist möglich, Dokumentation für einzelne Übereinstimmungsfälle eines exportierten Makros zu schreiben.Wie wird die Dokumentation für eindeutige Übereinstimmungsfälle in Makros eingefügt?

/// 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) => { ... }; 
} 

Ist so etwas möglich oder muss ich es so zu tun haben:

/// 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) => { ... }; 
} 

Antwort

2

Sie können nicht. Der einzige Ort, an dem Sie Dokumentation an ein Makro anhängen können, ist das Makro als Ganzes.

Verwandte Themen