fn create_method_runtime_api_impl(&mut self, mut method: TraitItemMethod) -> Option<TraitItemMethod> {
		if remove_supported_attributes(&mut method.attrs).contains_key(CHANGED_IN_ATTRIBUTE) {
			return None;
		}

		let fn_decl = &method.sig.decl;
		let ret_type = return_type_extract_type(&fn_decl.output);

		// Get types and if the value is borrowed from all parameters.
		// If there is an error, we push it as the block to the user.
		let param_types = match extract_parameter_names_types_and_borrows(fn_decl) {
			Ok(res) => res.into_iter().map(|v| {
				let ty = v.1;
				let borrow = v.2;
				quote!( #borrow #ty )
			}).collect::<Vec<_>>(),
			Err(e) => {
				self.errors.push(e.to_compile_error());
				Vec::new()
			}
		};
		let name = generate_method_runtime_api_impl_name(&self.trait_, &method.sig.ident);
		let block_id = self.block_id;
		let crate_ = self.crate_;

		Some(
			parse_quote!{
				#[doc(hidden)]
				fn #name(
					&self,
					at: &#block_id,
					context: #crate_::runtime_api::ExecutionContext,
					params: Option<( #( #param_types ),* )>,
					params_encoded: Vec<u8>,
				) -> #crate_::error::Result<#crate_::runtime_api::NativeOrEncoded<#ret_type>>;
			}
		)
	}
/// Takes the given method and creates a `method_runtime_api_impl` method that will be
/// implemented in the runtime for the client side.
Takes the given method and creates a `method_runtime_api_impl` method that will be
implemented in the runtime for the client side.
Takes the given method and creates a ` method_runtime_api_impl ` method that will be implemented in the runtime for the client side .
fn create_method_runtime_api_impl(&mut self, mut method: TraitItemMethod) -> Option<TraitItemMethod> {
		if remove_supported_attributes(&mut method.attrs).contains_key(CHANGED_IN_ATTRIBUTE) {
			return None;
		}
		let fn_decl = &method.sig.decl;
		let ret_type = return_type_extract_type(&fn_decl.output);
		// Get types and if the value is borrowed from all parameters.
		// If there is an error, we push it as the block to the user.
		let param_types = match extract_parameter_names_types_and_borrows(fn_decl) {
			Ok(res) => res.into_iter().map(|v| {
				let ty = v.1;
				let borrow = v.2;
				quote!( #borrow #ty )
			}).collect::<Vec<_>>(),
			Err(e) => {
				self.errors.push(e.to_compile_error());
				Vec::new()
			}
		};
		let name = generate_method_runtime_api_impl_name(&self.trait_, &method.sig.ident);
		let block_id = self.block_id;
		let crate_ = self.crate_;
		Some(
			parse_quote!{
				#[doc(hidden)]
				fn #name(
					&self,
					at: &#block_id,
					context: #crate_::runtime_api::ExecutionContext,
					params: Option<( #( #param_types ),* )>,
					params_encoded: Vec<u8>,
				) -> #crate_::error::Result<#crate_::runtime_api::NativeOrEncoded<#ret_type>>;
			}
		)
	}
fn create_method_runtime_api_impl ( & mut self , mut method : TraitItemMethod ) -> Option < TraitItemMethod > { if remove_supported_attributes ( & mut method . attrs ) . contains_key ( CHANGED_IN_ATTRIBUTE ) { return None ; } let fn_decl = & method . sig . decl ; let ret_type = return_type_extract_type ( & fn_decl . output ) ; // Get types and if the value is borrowed from all parameters. // If there is an error, we push it as the block to the user. let param_types = match extract_parameter_names_types_and_borrows ( fn_decl ) { Ok ( res ) => res . into_iter ( ) . map ( | v | { let ty = v . 1 ; let borrow = v . 2 ; quote ! ( borrow ty ) } ) . collect :: < Vec < _ > > ( ) , Err ( e ) => { self . errors . push ( e . to_compile_error ( ) ) ; Vec :: new ( ) } } ; let name = generate_method_runtime_api_impl_name ( & self . trait_ , & method . sig . ident ) ; let block_id = self . block_id ; let crate_ = self . crate_ ; Some ( parse_quote ! { [ doc ( hidden ) ] fn name ( self at block_id context crate_ runtime_api ExecutionContext params Option ( ( param_types ) ) params_encoded Vec u8 ) crate_ error Result crate_ runtime_api NativeOrEncoded ret_type } ) }
Takes the given method and creates a `method_runtime_api_impl` method that will be
implemented in the runtime for the client side.
Takes the given method and creates a ` method_runtime_api_impl ` method that will be implemented in the runtime for the client side .
&mut self
method
TraitItemMethod
&mut self
method
TraitItemMethod