Macros

  • This macro is the primary way to bring exported tokens into scope in your proc macros (though it can also be used in non-proc-macro contexts, and is based on TokenStream2 for this purpose).
  • This macro allows you to import tokens across crate boundaries without strict dependency requirements and to use advanced features such as namespacing.
  • This convenient macro can be used to publicly re-export an item that has been exported via export_tokens when doing direct imports. See the documentation for export_tokens and import_tokens! for more information.
  • The read_namespace allows you to group a number of #[export_tokens] calls and collect them into a [Result<Vec<(String, TokenStream2)>>].

Attribute Macros

  • This attribute can be attached to any syn::Item-compatible source code item, with the exception of [ForeignMod'](syn::Item::ForeignMod), [Impl](syn::Item::Impl), [Macro](syn::Item::Macro), [Use](syn::Item::Use), and [Verbatim](syn::Item::Verbatim). Attaching to an item will "export" that item so that it can be imported elsewhere by name via the [import_tokens!`] macro.