Improve mock_impl_runtime_apis! (#7370)

* Improve `mock_impl_runtime_apis!`

This adds a new attribute for functions being implemented in the
`mock_impl_runtime_apis!` macro, the `advanced` attribute. When this
attribute is given the user gets access to the `at` parameter and is
able to return a `Result`, instead of letting the macro generate this
stuff.

* Use the `at_param_name` directly

* Prevent clashing of `params`
This commit is contained in:
Bastian Köcher
2020-10-22 21:09:13 +02:00
committed by GitHub
parent d847c9b019
commit 79be077774
9 changed files with 287 additions and 46 deletions
+7
View File
@@ -196,6 +196,13 @@ pub enum NativeOrEncoded<R> {
Encoded(Vec<u8>)
}
#[cfg(feature = "std")]
impl<R> From<R> for NativeOrEncoded<R> {
fn from(val: R) -> Self {
Self::Native(val)
}
}
#[cfg(feature = "std")]
impl<R: codec::Encode> sp_std::fmt::Debug for NativeOrEncoded<R> {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {