Importing Macros

It’s often useful to be able to use a macro from more than one module. Proc macros can only be invoked in a different module.

Enter the import macro.

import is a module-level macro that allows you to use macros defined in another module. It has two forms:

![import(module)]

Import all macros defined in module.

![import (name1, name2, ... from module)]

Import only the specified macros from module.

Note

One quirk of the import macro is that macro_rules imports are transitive (if module b imports a macro_rules macro from module a, and then module c imports b, the macro_rules macro from a will be imported into c). Proc macro imports, however, are not transitive.