How to write macro documentation correctly if a macro is defined in a module?

I defined a macro in a module and it works great. Now I'm trying to document a macro with an example. Apparently , I need to manually specify the box line to request macros:

/// ```
/// # #[macro_use] extern crate foo;
/// // Some code
/// ```

However, now I get the error message:

error: an `extern crate` loading macros must be at the crate root

Apparently, the sample code is loaded into the macro mode and does not seem to be compatible with macro_use...

I can’t believe that everyone writes macros directly in the root module ... right?

+4
source share
1 answer

, , . ( ), , , , , " " . !

, :

/// # fn main() { }
+2

All Articles