fn generate_api_impl_for_runtime_api(impls: &[ItemImpl]) -> Result<TokenStream> {
	let mut result = Vec::with_capacity(impls.len());

	for impl_ in impls {
		let impl_trait_path = extract_impl_trait(&impl_)?;
		let impl_trait = &impl_trait_path
			.segments
			.last()
			.ok_or_else(|| Error::new(impl_trait_path.span(), "Empty trait path not possible!"))?
			.into_value();
		let runtime_block = extract_runtime_block_ident(impl_trait_path)?;
		let (node_block, node_block_id) = generate_node_block_and_block_id_ty(&impl_.self_ty);
		let runtime_type = &impl_.self_ty;
		let mut runtime_mod_path = extend_with_runtime_decl_path(impl_trait_path.clone());
		// remove the trait to get just the module path
		runtime_mod_path.segments.pop();

		let trait_generic_arguments = match impl_trait.arguments {
			PathArguments::Parenthesized(_) | PathArguments::None => vec![],
			PathArguments::AngleBracketed(ref b) => b.args.iter().cloned().collect(),
		};

		let mut visitor = ApiRuntimeImplToApiRuntimeApiImpl {
			runtime_block,
			node_block: &node_block,
			node_block_id: &node_block_id,
			runtime_mod_path: &runtime_mod_path,
			runtime_type: &*runtime_type,
			trait_generic_arguments: &trait_generic_arguments,
			impl_trait: &impl_trait.ident,
		};

		result.push(visitor.fold_item_impl(impl_.clone()));
	}
	Ok(quote!( #( #result )* ))
}
/// Generate the implementations of the runtime apis for the `RuntimeApi` type.
Generate the implementations of the runtime apis for the `RuntimeApi` type.
Generate the implementations of the runtime apis for the ` RuntimeApi ` type .
fn generate_api_impl_for_runtime_api(impls: &[ItemImpl]) -> Result<TokenStream> {
	let mut result = Vec::with_capacity(impls.len());
	for impl_ in impls {
		let impl_trait_path = extract_impl_trait(&impl_)?;
		let impl_trait = &impl_trait_path
			.segments
			.last()
			.ok_or_else(|| Error::new(impl_trait_path.span(), "Empty trait path not possible!"))?
			.into_value();
		let runtime_block = extract_runtime_block_ident(impl_trait_path)?;
		let (node_block, node_block_id) = generate_node_block_and_block_id_ty(&impl_.self_ty);
		let runtime_type = &impl_.self_ty;
		let mut runtime_mod_path = extend_with_runtime_decl_path(impl_trait_path.clone());
		// remove the trait to get just the module path
		runtime_mod_path.segments.pop();
		let trait_generic_arguments = match impl_trait.arguments {
			PathArguments::Parenthesized(_) | PathArguments::None => vec![],
			PathArguments::AngleBracketed(ref b) => b.args.iter().cloned().collect(),
		};
		let mut visitor = ApiRuntimeImplToApiRuntimeApiImpl {
			runtime_block,
			node_block: &node_block,
			node_block_id: &node_block_id,
			runtime_mod_path: &runtime_mod_path,
			runtime_type: &*runtime_type,
			trait_generic_arguments: &trait_generic_arguments,
			impl_trait: &impl_trait.ident,
		};
		result.push(visitor.fold_item_impl(impl_.clone()));
	}
	Ok(quote!( #( #result )* ))
}
fn generate_api_impl_for_runtime_api ( impls : & [ ItemImpl ] ) -> Result < TokenStream > { let mut result = Vec :: with_capacity ( impls . len ( ) ) ; for impl_ in impls { let impl_trait_path = extract_impl_trait ( & impl_ ) ? ; let impl_trait = & impl_trait_path . segments . last ( ) . ok_or_else ( | | Error :: new ( impl_trait_path . span ( ) , " " ) ) ? . into_value ( ) ; let runtime_block = extract_runtime_block_ident ( impl_trait_path ) ? ; let ( node_block , node_block_id ) = generate_node_block_and_block_id_ty ( & impl_ . self_ty ) ; let runtime_type = & impl_ . self_ty ; let mut runtime_mod_path = extend_with_runtime_decl_path ( impl_trait_path . clone ( ) ) ; // remove the trait to get just the module path runtime_mod_path . segments . pop ( ) ; let trait_generic_arguments = match impl_trait . arguments { PathArguments :: Parenthesized ( _ ) | PathArguments :: None => vec ! [ ] , PathArguments :: AngleBracketed ( ref b ) => b . args . iter ( ) . cloned ( ) . collect ( ) , } ; let mut visitor = ApiRuntimeImplToApiRuntimeApiImpl { runtime_block , node_block : & node_block , node_block_id : & node_block_id , runtime_mod_path : & runtime_mod_path , runtime_type : & * runtime_type , trait_generic_arguments : & trait_generic_arguments , impl_trait : & impl_trait . ident , } ; result . push ( visitor . fold_item_impl ( impl_ . clone ( ) ) ) ; } Ok ( quote ! ( ( result ) ) ) }
Generate the implementations of the runtime apis for the `RuntimeApi` type.
Generate the implementations of the runtime apis for the ` RuntimeApi ` type .
impls
&[ItemImpl]
impls
&[ItemImpl]