mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 01:07:57 +00:00
Fix parameter_types! macro (#8594)
Make it work with different kinds of parameter types when `static` is one of them.
This commit is contained in:
@@ -379,21 +379,20 @@ macro_rules! parameter_types {
|
||||
}
|
||||
};
|
||||
(
|
||||
$(
|
||||
$( #[ $attr:meta ] )*
|
||||
$vis:vis static $name:ident: $type:ty = $value:expr;
|
||||
)*
|
||||
$( #[ $attr:meta ] )*
|
||||
$vis:vis static $name:ident: $type:ty = $value:expr;
|
||||
$( $rest:tt )*
|
||||
) => (
|
||||
$crate::parameter_types_impl_thread_local!(
|
||||
$(
|
||||
$( #[ $attr ] )*
|
||||
$vis static $name: $type = $value;
|
||||
)*
|
||||
$( #[ $attr ] )*
|
||||
$vis static $name: $type = $value;
|
||||
);
|
||||
$crate::parameter_types!( $( $rest )* );
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[doc(inline)]
|
||||
#[macro_export]
|
||||
macro_rules! parameter_types_impl_thread_local {
|
||||
( $( $any:tt )* ) => {
|
||||
@@ -402,6 +401,7 @@ macro_rules! parameter_types_impl_thread_local {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[doc(inline)]
|
||||
#[macro_export]
|
||||
macro_rules! parameter_types_impl_thread_local {
|
||||
(
|
||||
@@ -1217,6 +1217,12 @@ pub mod tests {
|
||||
assert_eq!(300, StorageParameter::get());
|
||||
})
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub static Members: Vec<u64> = vec![];
|
||||
pub const Foo: Option<u64> = None;
|
||||
}
|
||||
}
|
||||
|
||||
/// Prelude to be used alongside pallet macro, for ease of use.
|
||||
|
||||
Reference in New Issue
Block a user