pub fn extract_parameter_names_types_and_borrows(fn_decl: &FnDecl)
	-> Result<Vec<(Pat, Type, TokenStream)>>
{
	let mut result = Vec::new();
	let mut generated_pattern_counter = 0;
	for input in fn_decl.inputs.iter() {
		match input {
			FnArg::Captured(arg) => {
				let (ty, borrow) = match &arg.ty {
					Type::Reference(t) => {
						let ty = &t.elem;
						(parse_quote!( #ty ), quote!( & ))
					},
					t => { (t.clone(), quote!()) },
				};

				let name =
					generate_unique_pattern(arg.pat.clone(), &mut generated_pattern_counter);
				result.push((name, ty, borrow));
			},
			_ => {
				return Err(
					Error::new(
						input.span(),
						"Only function arguments with the following \
						pattern are accepted: `name: type`!"
					)
				)
			}
		}
	}

	Ok(result)
}
/// Extracts the name, the type and `&` or ``(if it is a reference or not)
/// for each parameter in the given function declaration.
Extracts the name, the type and `&` or ``(if it is a reference or not)
for each parameter in the given function declaration.
Extracts the name the type and ` & ` or ` ` ( if it is a reference or not ) for each parameter in the given function declaration .
pub fn extract_parameter_names_types_and_borrows(fn_decl: &FnDecl)
	-> Result<Vec<(Pat, Type, TokenStream)>>
{
	let mut result = Vec::new();
	let mut generated_pattern_counter = 0;
	for input in fn_decl.inputs.iter() {
		match input {
			FnArg::Captured(arg) => {
				let (ty, borrow) = match &arg.ty {
					Type::Reference(t) => {
						let ty = &t.elem;
						(parse_quote!( #ty ), quote!( & ))
					},
					t => { (t.clone(), quote!()) },
				};
				let name =
					generate_unique_pattern(arg.pat.clone(), &mut generated_pattern_counter);
				result.push((name, ty, borrow));
			},
			_ => {
				return Err(
					Error::new(
						input.span(),
						"Only function arguments with the following \
						pattern are accepted: `name: type`!"
					)
				)
			}
		}
	}
	Ok(result)
}
pub fn extract_parameter_names_types_and_borrows ( fn_decl : & FnDecl ) -> Result < Vec < ( Pat , Type , TokenStream ) > > { let mut result = Vec :: new ( ) ; let mut generated_pattern_counter = 0 ; for input in fn_decl . inputs . iter ( ) { match input { FnArg :: Captured ( arg ) => { let ( ty , borrow ) = match & arg . ty { Type :: Reference ( t ) => { let ty = & t . elem ; ( parse_quote ! ( ty ) , quote ! ( ) ) } , t => { ( t . clone ( ) , quote ! ( ) ) } , } ; let name = generate_unique_pattern ( arg . pat . clone ( ) , & mut generated_pattern_counter ) ; result . push ( ( name , ty , borrow ) ) ; } , _ => { return Err ( Error :: new ( input . span ( ) , " \
 " ) ) } } } Ok ( result ) }
Extracts the name, the type and `&` or ``(if it is a reference or not)
for each parameter in the given function declaration.
Extracts the name the type and ` & ` or ` ` ( if it is a reference or not ) for each parameter in the given function declaration .
fn_decl
&FnDecl
fn_decl
&FnDecl