Function macro_magic_core::export_tokens_internal
source · pub fn export_tokens_internal<T: Into<TokenStream>, E: Into<TokenStream>>(
attr: T,
tokens: E,
emit: bool,
hide_exported_ident: bool,
) -> Result<TokenStream>
Expand description
The internal code behind the #[export_tokens]
attribute macro.
The attr
variable contains the tokens for the optional naming Ident
(necessary
on Item
s that don’t have an inherent Ident
), and the tokens
variable is
the tokens for the Item
the attribute macro can be attached to. The attr
variable can
be blank tokens for supported items, which include every valid syn::Item
except for
syn::ItemForeignMod
, syn::ItemUse
, syn::ItemImpl
, and Item::Verbatim
, which
all require attr
to be specified.
An empty TokenStream2
is sufficient for opting out of using attr
The hide_exported_ident
variable specifies whether the macro uses an auto-generated name
via export_tokens_macro_ident
or the name of the item itself.