use proc_macro2::TokenStream;
use quote::quote;
use syn::{Field, Ident, Index};
pub fn tuple_exprs(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> {
let mut exprs = vec![];
for i in 0..fields.len() {
let i = Index::from(i);
let expr = quote!(self.#i.#method_ident(rhs.#i));
exprs.push(expr);
}
exprs
}
pub fn struct_exprs(fields: &[&Field], method_ident: &Ident) -> Vec<TokenStream> {
let mut exprs = vec![];
for field in fields {
let field_id = field.ident.as_ref().unwrap();
let expr = quote!(self.#field_id.#method_ident(rhs.#field_id));
exprs.push(expr)
}
exprs
}