fn generate_runtime_decls(decls: &[ItemTrait]) -> TokenStream {
	let mut result = Vec::new();

	for decl in decls {
		let mut decl = decl.clone();
		extend_generics_with_block(&mut decl.generics);
		let mod_name = generate_runtime_mod_name_for_trait(&decl.ident);
		let found_attributes = remove_supported_attributes(&mut decl.attrs);
		let api_version = unwrap_or_error(get_api_version(&found_attributes).map(|v| {
			generate_runtime_api_version(v as u32)
		}));
		let id = generate_runtime_api_id(&decl.ident.to_string());

		let call_api_at_calls = unwrap_or_error(generate_call_api_at_calls(&decl));

		// Remove methods that have the `changed_in` attribute as they are not required for the
		// runtime anymore.
		decl.items = decl.items.iter_mut().filter_map(|i| match i {
			TraitItem::Method(ref mut method) => {
				if remove_supported_attributes(&mut method.attrs).contains_key(CHANGED_IN_ATTRIBUTE) {
					None
				} else {
					Some(TraitItem::Method(method.clone()))
				}
			}
			r => Some(r.clone()),
		}).collect();

		let native_call_generators = unwrap_or_error(generate_native_call_generators(&decl));

		result.push(quote!(
			#[doc(hidden)]
			#[allow(dead_code)]
			#[allow(deprecated)]
			pub mod #mod_name {
				use super::*;

				#decl

				pub #api_version

				pub #id

				#native_call_generators

				#call_api_at_calls
			}
		));
	}

	quote!( #( #result )* )
}
/// Generate the declaration of the trait for the runtime.
Generate the declaration of the trait for the runtime.
Generate the declaration of the trait for the runtime .
fn generate_runtime_decls(decls: &[ItemTrait]) -> TokenStream {
	let mut result = Vec::new();
	for decl in decls {
		let mut decl = decl.clone();
		extend_generics_with_block(&mut decl.generics);
		let mod_name = generate_runtime_mod_name_for_trait(&decl.ident);
		let found_attributes = remove_supported_attributes(&mut decl.attrs);
		let api_version = unwrap_or_error(get_api_version(&found_attributes).map(|v| {
			generate_runtime_api_version(v as u32)
		}));
		let id = generate_runtime_api_id(&decl.ident.to_string());
		let call_api_at_calls = unwrap_or_error(generate_call_api_at_calls(&decl));
		// Remove methods that have the `changed_in` attribute as they are not required for the
		// runtime anymore.
		decl.items = decl.items.iter_mut().filter_map(|i| match i {
			TraitItem::Method(ref mut method) => {
				if remove_supported_attributes(&mut method.attrs).contains_key(CHANGED_IN_ATTRIBUTE) {
					None
				} else {
					Some(TraitItem::Method(method.clone()))
				}
			}
			r => Some(r.clone()),
		}).collect();
		let native_call_generators = unwrap_or_error(generate_native_call_generators(&decl));
		result.push(quote!(
			#[doc(hidden)]
			#[allow(dead_code)]
			#[allow(deprecated)]
			pub mod #mod_name {
				use super::*;
				#decl
				pub #api_version
				pub #id
				#native_call_generators
				#call_api_at_calls
			}
		));
	}
	quote!( #( #result )* )
}
fn generate_runtime_decls ( decls : & [ ItemTrait ] ) -> TokenStream { let mut result = Vec :: new ( ) ; for decl in decls { let mut decl = decl . clone ( ) ; extend_generics_with_block ( & mut decl . generics ) ; let mod_name = generate_runtime_mod_name_for_trait ( & decl . ident ) ; let found_attributes = remove_supported_attributes ( & mut decl . attrs ) ; let api_version = unwrap_or_error ( get_api_version ( & found_attributes ) . map ( | v | { generate_runtime_api_version ( v as u32 ) } ) ) ; let id = generate_runtime_api_id ( & decl . ident . to_string ( ) ) ; let call_api_at_calls = unwrap_or_error ( generate_call_api_at_calls ( & decl ) ) ; // Remove methods that have the `changed_in` attribute as they are not required for the // runtime anymore. decl . items = decl . items . iter_mut ( ) . filter_map ( | i | match i { TraitItem :: Method ( ref mut method ) => { if remove_supported_attributes ( & mut method . attrs ) . contains_key ( CHANGED_IN_ATTRIBUTE ) { None } else { Some ( TraitItem :: Method ( method . clone ( ) ) ) } } r => Some ( r . clone ( ) ) , } ) . collect ( ) ; let native_call_generators = unwrap_or_error ( generate_native_call_generators ( & decl ) ) ; result . push ( quote ! ( [ doc ( hidden ) ] [ allow ( dead_code ) ] [ allow ( deprecated ) ] pub mod mod_name { use super decl pub api_version pub id native_call_generators call_api_at_calls } ) ) ; } quote ! ( ( result ) ) }
Generate the declaration of the trait for the runtime.
Generate the declaration of the trait for the runtime .
decls
&[ItemTrait]
decls
&[ItemTrait]