pub fn derive<Item: AnyTokenStream, Dummy: AnyTokenStream, Output: MacroOutput, Return: AnyTokenStream, Function>(
item: impl AnyTokenStream,
body: impl DeriveMacroHandler<Function, Item = Item, Dummy = Dummy, Output = Output>,
) -> ReturnExpand description
Handles proc_macro_derive
implementation.
Use derive! to support Parse and ToTokens as well.
Takes any TokenStream for item and returns any TokenStream. body
takes a DeriveMacroHandler with one TokenStream parameter. And an
optional &mut Emitter and &mut TokenStream for storing a
dummy output.
use manyhow::{derive, Emitter, Result};
use proc_macro2::TokenStream;
derive(
item,
|item: TokenStream, dummy: &mut TokenStream, emitter: &mut Emitter| -> Result {
// ..
},
);