How do I properly write macro documentation if the macro is defined in a module?

后端 未结 1 426
情歌与酒
情歌与酒 2021-01-19 04:11

I defined a macro in a module, and it works fine. Now, I\'m trying to document said macro with an example. Apparently, I need to manually specify the crate line to ask for m

1条回答
  •  迷失自我
    2021-01-19 04:39

    Well adding a main function did the trick. My example code did not need to run anything (just compile) so I didn't even bother adding a main function, but apparently adding it puts the code in a virtual "crate root", and it accepts the macro_use. Yay!

    So what I did is just add :

    /// # fn main() { }
    

    0 讨论(0)
提交回复
热议问题