mirror of
https://github.com/Start9Labs/rpc-toolkit.git
synced 2026-03-26 02:11:56 +00:00
switch iterator to vec
This commit is contained in:
@@ -747,27 +747,30 @@ fn cli_handler(
|
|||||||
let fn_turbofish = fn_type_generics.as_turbofish();
|
let fn_turbofish = fn_type_generics.as_turbofish();
|
||||||
let fn_path: Path = macro_try!(syn::parse2(quote! { super::#fn_name#fn_turbofish }));
|
let fn_path: Path = macro_try!(syn::parse2(quote! { super::#fn_name#fn_turbofish }));
|
||||||
let is_parent = matches!(opt, Options::Parent { .. });
|
let is_parent = matches!(opt, Options::Parent { .. });
|
||||||
let param = params.iter().map(|param| match param {
|
let param: Vec<_> = params
|
||||||
ParamType::Arg(arg) => {
|
.iter()
|
||||||
let name = arg.name.clone().unwrap();
|
.map(|param| match param {
|
||||||
let field_name = Ident::new(&format!("arg_{}", name), name.span());
|
ParamType::Arg(arg) => {
|
||||||
quote! { params.#field_name.clone() }
|
let name = arg.name.clone().unwrap();
|
||||||
}
|
let field_name = Ident::new(&format!("arg_{}", name), name.span());
|
||||||
ParamType::Context(ty) => {
|
quote! { params.#field_name.clone() }
|
||||||
if is_parent {
|
|
||||||
quote! { <GenericContext as Into<#ty>>::into(ctx.clone()) }
|
|
||||||
} else {
|
|
||||||
quote! { <GenericContext as Into<#ty>>::into(ctx) }
|
|
||||||
}
|
}
|
||||||
}
|
ParamType::Context(ty) => {
|
||||||
ParamType::ParentData(ty) => {
|
if is_parent {
|
||||||
parent_data_ty = quote! { #ty };
|
quote! { <GenericContext as Into<#ty>>::into(ctx.clone()) }
|
||||||
quote! { parent_data }
|
} else {
|
||||||
}
|
quote! { <GenericContext as Into<#ty>>::into(ctx) }
|
||||||
ParamType::Request => quote! { request },
|
}
|
||||||
ParamType::Response => quote! { response },
|
}
|
||||||
ParamType::None => unreachable!(),
|
ParamType::ParentData(ty) => {
|
||||||
});
|
parent_data_ty = quote! { #ty };
|
||||||
|
quote! { parent_data }
|
||||||
|
}
|
||||||
|
ParamType::Request => quote! { request },
|
||||||
|
ParamType::Response => quote! { response },
|
||||||
|
ParamType::None => unreachable!(),
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
let mut param_generics_filter = GenericFilter::new(fn_generics);
|
let mut param_generics_filter = GenericFilter::new(fn_generics);
|
||||||
for param in params {
|
for param in params {
|
||||||
if let ParamType::Arg(a) = param {
|
if let ParamType::Arg(a) = param {
|
||||||
|
|||||||
Reference in New Issue
Block a user