parse_more_auto_impl

Macro parse_more_auto_impl 

Source
macro_rules! parse_more_auto_impl {
    ($($ty:ty),*) => { ... };
}
Expand description

This macro auto-implements the ParseMore traits on its arguments, which MUST implement the syn::parse::Parse trait. It allows using custom types inside of any parse-more macros/functions.

See the parse_more macro.

ยงExample

use parse_more::parse_more_auto_impl;
use syn::{Ident, Token};

struct MyParsedStruct(Ident, Ident);

impl syn::parse::Parse for MyParsedStruct {
    fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
        let a = input.parse()?;
        input.parse::<Token![=>]>()?;
        let b = input.parse()?;
        Ok(Self(a, b))
    }
}

parse_more_auto_impl! {
    MyParsedStruct
}