logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use proc_macro2::TokenStream as TokenStream2;
use quote::ToTokens;
use syn::{
    parse::{Parse, ParseStream},
    punctuated::Punctuated,
    Field, Result, Token,
};

pub struct AdditionalFields {
    pub inner: Punctuated<Field, Token![,]>,
}

impl Parse for AdditionalFields {
    fn parse(input: ParseStream) -> Result<Self> {
        Ok(AdditionalFields {
            inner: input.parse_terminated(Field::parse_named)?,
        })
    }
}

impl ToTokens for AdditionalFields {
    fn to_tokens(&self, tokens: &mut TokenStream2) {
        tokens.extend(self.inner.to_token_stream());
    }
}