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

	for impl_ in impls {
		let mut path = extend_with_runtime_decl_path(extract_impl_trait(&impl_)?.clone());
		// Remove the trait
		let trait_ = path
			.segments
			.pop()
			.expect("extract_impl_trait already checks that this is valid; qed")
			.into_value()
			.ident;

		let span = trait_.span();
		if !processed_traits.insert(trait_) {
			return Err(
				Error::new(
					span,
					"Two traits with the same name detected! \
					The trait name is used to generate its ID. \
					Please rename one trait at the declaration!"
				)
			)
		}

		let id: Path = parse_quote!( #path ID );
		let version: Path = parse_quote!( #path VERSION );

		result.push(quote!( (#id, #version) ));
	}

	let c = generate_crate_access(HIDDEN_INCLUDES_ID);

	Ok(quote!(
		const RUNTIME_API_VERSIONS: #c::runtime_api::ApisVec =
			#c::runtime_api::create_apis_vec!([ #( #result ),* ]);
	))
}
/// Generates `RUNTIME_API_VERSIONS` that holds all version information about the implemented
/// runtime apis.
Generates `RUNTIME_API_VERSIONS` that holds all version information about the implemented
runtime apis.
Generates ` RUNTIME_API_VERSIONS ` that holds all version information about the implemented runtime apis .
fn generate_runtime_api_versions(impls: &[ItemImpl]) -> Result<TokenStream> {
	let mut result = Vec::with_capacity(impls.len());
	let mut processed_traits = HashSet::new();
	for impl_ in impls {
		let mut path = extend_with_runtime_decl_path(extract_impl_trait(&impl_)?.clone());
		// Remove the trait
		let trait_ = path
			.segments
			.pop()
			.expect("extract_impl_trait already checks that this is valid; qed")
			.into_value()
			.ident;
		let span = trait_.span();
		if !processed_traits.insert(trait_) {
			return Err(
				Error::new(
					span,
					"Two traits with the same name detected! \
					The trait name is used to generate its ID. \
					Please rename one trait at the declaration!"
				)
			)
		}
		let id: Path = parse_quote!( #path ID );
		let version: Path = parse_quote!( #path VERSION );
		result.push(quote!( (#id, #version) ));
	}
	let c = generate_crate_access(HIDDEN_INCLUDES_ID);
	Ok(quote!(
		const RUNTIME_API_VERSIONS: #c::runtime_api::ApisVec =
			#c::runtime_api::create_apis_vec!([ #( #result ),* ]);
	))
}
fn generate_runtime_api_versions ( impls : & [ ItemImpl ] ) -> Result < TokenStream > { let mut result = Vec :: with_capacity ( impls . len ( ) ) ; let mut processed_traits = HashSet :: new ( ) ; for impl_ in impls { let mut path = extend_with_runtime_decl_path ( extract_impl_trait ( & impl_ ) ? . clone ( ) ) ; // Remove the trait let trait_ = path . segments . pop ( ) . expect ( " " ) . into_value ( ) . ident ; let span = trait_ . span ( ) ; if ! processed_traits . insert ( trait_ ) { return Err ( Error :: new ( span , " \
 \
 " ) ) } let id : Path = parse_quote ! ( path ID ) ; let version : Path = parse_quote ! ( path VERSION ) ; result . push ( quote ! ( ( id version ) ) ) ; } let c = generate_crate_access ( HIDDEN_INCLUDES_ID ) ; Ok ( quote ! ( const RUNTIME_API_VERSIONS c runtime_api ApisVec c runtime_api create_apis_vec ( [ ( result ) ] ) ) ) }
Generates `RUNTIME_API_VERSIONS` that holds all version information about the implemented
runtime apis.
Generates ` RUNTIME_API_VERSIONS ` that holds all version information about the implemented runtime apis .
impls
&[ItemImpl]
impls
&[ItemImpl]