diff --git a/substrate/core/executor/src/native_executor.rs b/substrate/core/executor/src/native_executor.rs index 685aa485728f442e5a5b1a14872f39cd97e83d45..b51b43e14dd1976607b5fc3431ae527cef402fc6 100644 --- a/substrate/core/executor/src/native_executor.rs +++ b/substrate/core/executor/src/native_executor.rs @@ -196,13 +196,9 @@ impl<D: NativeExecutionDispatch> CodeExecutor<Blake2Hasher> for NativeExecutor<D #[macro_export] macro_rules! native_executor_instance { - (pub $name:ident, $dispatcher:path, $version:path, $code:expr) => { - pub struct $name; - native_executor_instance!(IMPL $name, $dispatcher, $version, $code); - }; - ($name:ident, $dispatcher:path, $version:path, $code:expr) => { + ( $pub:vis $name:ident, $dispatcher:path, $version:path, $code:expr) => { /// A unit struct which implements `NativeExecutionDispatch` feeding in the hard-coded runtime. - struct $name; + $pub struct $name; native_executor_instance!(IMPL $name, $dispatcher, $version, $code); }; (IMPL $name:ident, $dispatcher:path, $version:path, $code:expr) => { diff --git a/substrate/srml/support/src/storage/generator.rs b/substrate/srml/support/src/storage/generator.rs index 586ec5eb2bce36f3d0c3c963b0b22d3e2e86ca27..4604c5b3b01bacc0cfcd30cd83a1e8bc74a2732c 100644 --- a/substrate/srml/support/src/storage/generator.rs +++ b/substrate/srml/support/src/storage/generator.rs @@ -681,7 +681,7 @@ macro_rules! __generate_genesis_config { #[macro_export] macro_rules! decl_storage { ( - trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { + $pub:vis trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { $($t:tt)* } add_extra_genesis { @@ -690,7 +690,7 @@ macro_rules! decl_storage { } ) => { __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - trait $storetype { + $pub trait $storetype { __decl_store_items!($($t)*); } impl<$traitinstance: $traittype> $storetype for $modulename<$traitinstance> { @@ -703,33 +703,12 @@ macro_rules! decl_storage { __decl_genesis_config_items!([$traittype $traitinstance] [] [] [] [$( $(#[$attr])* $extrafield : $extraty $(= $default)* ; )* ] [$call] $($t)*); }; ( - pub trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { + $pub:vis trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { $($t:tt)* } - add_extra_genesis { - $( $(#[$attr:meta])* config($extrafield:ident) : $extraty:ty $(= $default:expr)* ;)* - build($call:expr); - } ) => { __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - pub trait $storetype { - __decl_store_items!($($t)*); - } - impl<$traitinstance: $traittype> $storetype for $modulename<$traitinstance> { - __impl_store_items!($traitinstance $($t)*); - } - impl<$traitinstance: $traittype> $modulename<$traitinstance> { - __impl_store_fns!($traitinstance $($t)*); - } - __decl_genesis_config_items!([$traittype $traitinstance] [] [] [] [$( $(#[$attr])* $extrafield : $extraty $(= $default)* ; )* ] [$call] $($t)*); - }; - ( - trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { - $($t:tt)* - } - ) => { - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - trait $storetype { + $pub trait $storetype { __decl_store_items!($($t)*); } impl<$traitinstance: $traittype> $storetype for $modulename<$traitinstance> { @@ -741,26 +720,8 @@ macro_rules! decl_storage { } __decl_genesis_config_items!([$traittype $traitinstance] [] [] [] [] [|_, _|{}] $($t)*); }; - ( - pub trait $storetype:ident for $modulename:ident<$traitinstance:ident: $traittype:ident> as $cratename:ident { - $($t:tt)* - } - ) => { - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - pub trait $storetype { - __decl_store_items!($($t)*); - } - impl<$traitinstance: $traittype> $storetype for $modulename<$traitinstance> { - __impl_store_items!($traitinstance $($t)*); - } - impl<$traitinstance: $traittype> $modulename<$traitinstance> { - __impl_store_fns!($traitinstance $($t)*); - } - __decl_genesis_config_items!([$traittype $traitinstance] [] [] [] [] [|_, _|{}] $($t)*); - } } -// TODO: when 'vis' is stablized, we could save the lines by half. #[macro_export] #[doc(hidden)] macro_rules! __decl_genesis_config_items { @@ -769,25 +730,13 @@ macro_rules! __decl_genesis_config_items { // - $default // we don't allow any config() or build() on this pattern. ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!([$traittype $traitinstance] [$($cur)*] [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] $($t)*); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!([$traittype $traitinstance] [$($cur)*] [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] $($t)*); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!([$traittype $traitinstance] [$($cur)*] [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] $($t)*); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!([$traittype $traitinstance] [$($cur)*] [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] $($t)*); @@ -797,205 +746,8 @@ macro_rules! __decl_genesis_config_items { // - pub // - build() // - $default - // so there are 8 cases here. - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : map $kty:ty => $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : map $kty:ty => $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)* $name ($build);] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)* $name ($build);] - [$($extras)*] - [$call] - $($t)* - ); - }; - - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : map $kty:ty => $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : map $kty:ty => $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)* $name ($build);] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)* $name ($build);] - [$($extras)*] - [$call] - $($t)* - ); - }; - - // simple values without getters: - // - pub - // - $default - // so there are 4 cases here. - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident : $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident : $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident : $ty:ty; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident : $ty:ty = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - - // simple values with getters: - // - pub - // - (empty) / config() / config(myname) - // - build() - // - $default - // so there are 24 cases here. - // Option<> types - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : Option<$ty:ty> = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : map $kty:ty => $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1009,150 +761,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = Default::default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$getfn.clone());] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default.unwrap_or_default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$getfn.clone());] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = Default::default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$myname.clone()); ] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default.unwrap_or_default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$myname.clone()); ] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - // build - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = Default::default();] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default.unwrap_or_default();] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = Default::default();] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default.unwrap_or_default();] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - - // pub - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : Option<$ty:ty>; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : map $kty:ty => $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1166,140 +775,45 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : Option<$ty:ty> = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] [$($cur)*] [$($nb)*] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = Default::default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$getfn.clone());] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default.unwrap_or_default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$getfn.clone());] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = Default::default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$myname.clone()); ] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default.unwrap_or_default();] - [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$myname.clone()); ] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - // build - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty> = $default:expr; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)*] - [$($nb)* $name ($build);] - [$($mapcur)*] - [$($extras)*] - [$call] - $($t)* - ); - }; - ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty>; - $($t:tt)* - ) => { - __decl_genesis_config_items!( - [$traittype $traitinstance] - [$($cur)* $getfn : $ty = Default::default();] - [$($nb)* $name ($build);] - [$($mapcur)*] + [$($mapcur)* $name ($build);] [$($extras)*] [$call] $($t)* ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty> = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : map $kty:ty => $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default.unwrap_or_default();] - [$($nb)* $name ($build);] - [$($mapcur)*] + [$($cur)*] + [$($nb)*] + [$($mapcur)* $name ($build);] [$($extras)*] [$call] $($t)* ); }; + + // simple values without getters: + // - pub + // - $default ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty>; + $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $myname : $ty = Default::default();] - [$($nb)* $name ($build);] + [$($cur)*] + [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] @@ -1307,13 +821,13 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty> = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default.unwrap_or_default();] - [$($nb)* $name ($build);] + [$($cur)*] + [$($nb)*] [$($mapcur)*] [$($extras)*] [$call] @@ -1321,10 +835,14 @@ macro_rules! __decl_genesis_config_items { ); }; - - // raw types + // simple values with getters: + // - pub + // - (empty) / config() / config(myname) + // - build() + // - $default + // Option<> types ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1338,7 +856,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1352,7 +870,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1366,12 +884,12 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default;] + [$($cur)* $getfn : $ty = $default.unwrap_or_default();] [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$getfn.clone());] [$($mapcur)*] [$($extras)*] @@ -1380,7 +898,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1394,12 +912,12 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default;] + [$($cur)* $myname : $ty = $default.unwrap_or_default();] [$($nb)* $name (|config: &GenesisConfig<$traitinstance>| config.$myname.clone()); ] [$($mapcur)*] [$($extras)*] @@ -1409,7 +927,7 @@ macro_rules! __decl_genesis_config_items { }; // build ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1423,7 +941,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1437,7 +955,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1451,12 +969,12 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() build($build:expr) : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $getfn : $ty = $default;] + [$($cur)* $getfn : $ty = $default.unwrap_or_default();] [$($nb)* $name ($build);] [$($mapcur)*] [$($extras)*] @@ -1465,7 +983,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty>; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1479,12 +997,12 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : Option<$ty:ty> = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( [$traittype $traitinstance] - [$($cur)* $myname : $ty = $default;] + [$($cur)* $myname : $ty = $default.unwrap_or_default();] [$($nb)* $name ($build);] [$($mapcur)*] [$($extras)*] @@ -1493,9 +1011,9 @@ macro_rules! __decl_genesis_config_items { ); }; - // pub + // raw types ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1509,7 +1027,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1523,7 +1041,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1537,7 +1055,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1551,7 +1069,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1565,7 +1083,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1580,7 +1098,7 @@ macro_rules! __decl_genesis_config_items { }; // build ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1594,7 +1112,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) build($build:expr) : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1608,7 +1126,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1622,7 +1140,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config() build($build:expr) : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1636,7 +1154,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1650,7 +1168,7 @@ macro_rules! __decl_genesis_config_items { ); }; ([$traittype:ident $traitinstance:ident] [$($cur:tt)*] [$($nb:tt)*] [$($mapcur:tt)*] [$($extras:tt)*] [$call:expr] - $(#[$doc:meta])* pub $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty = $default:expr; + $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) config($myname:ident) build($build:expr) : $ty:ty = $default:expr; $($t:tt)* ) => { __decl_genesis_config_items!( @@ -1680,42 +1198,24 @@ macro_rules! __decl_storage_items { // maps: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; // maps with getters: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: map $kty => $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; @@ -1723,42 +1223,24 @@ macro_rules! __decl_storage_items { // maps: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; // maps: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($fn:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: map $kty => $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; @@ -1766,21 +1248,12 @@ macro_rules! __decl_storage_items { // simple values without getters: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : Option<$ty:ty>; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : Option<$ty:ty> = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; @@ -1789,42 +1262,24 @@ macro_rules! __decl_storage_items { // - config() // - build() // - $default - // config() and build() can be combined, so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty>; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty>; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (OPTION_TYPE Option<$ty>) $cratename $name: $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; // simple values without getters: // - pub // - $default - // so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; @@ -1833,21 +1288,12 @@ macro_rules! __decl_storage_items { // - config() // - build() // - $default - // config() and build() can be combined, so there are 4 cases here. - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!(() ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = Default::default()); - __decl_storage_items!($cratename $traittype $traitinstance $($t)*); - }; - ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_storage_item!((pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); + ($cratename:ident $traittype:ident $traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($rename:ident)*))* $(build($fn:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { + __decl_storage_item!(($pub) ($traittype as $traitinstance) (RAW_TYPE $ty) $cratename $name: $ty = $default); __decl_storage_items!($cratename $traittype $traitinstance $($t)*); }; @@ -1859,8 +1305,8 @@ macro_rules! __decl_storage_items { #[doc(hidden)] macro_rules! __decl_storage_item { // generator for maps. - (($($vis:tt)*) ($traittype:ident as $traitinstance:ident) ($wraptype:ident $gettype:ty) $cratename:ident $name:ident : map $kty:ty => $ty:ty = $default:expr) => { - $($vis)* struct $name<$traitinstance: $traittype>($crate::storage::generator::PhantomData<$traitinstance>); + (($pub:vis) ($traittype:ident as $traitinstance:ident) ($wraptype:ident $gettype:ty) $cratename:ident $name:ident : map $kty:ty => $ty:ty = $default:expr) => { + $pub struct $name<$traitinstance: $traittype>($crate::storage::generator::PhantomData<$traitinstance>); impl<$traitinstance: $traittype> $crate::storage::generator::StorageMap<$kty, $ty> for $name<$traitinstance> { type Query = $gettype; @@ -1925,8 +1371,8 @@ macro_rules! __decl_storage_item { } }; // generator for values. - (($($vis:tt)*) ($traittype:ident as $traitinstance:ident) ($wraptype:ident $gettype:ty) $cratename:ident $name:ident : $ty:ty = $default:expr) => { - $($vis)* struct $name<$traitinstance: $traittype>($crate::storage::generator::PhantomData<$traitinstance>); + (($pub:vis) ($traittype:ident as $traitinstance:ident) ($wraptype:ident $gettype:ty) $cratename:ident $name:ident : $ty:ty = $default:expr) => { + $pub struct $name<$traitinstance: $traittype>($crate::storage::generator::PhantomData<$traitinstance>); impl<$traitinstance: $traittype> $crate::storage::generator::StorageValue<$ty> for $name<$traitinstance> { type Query = $gettype; @@ -1993,68 +1439,40 @@ macro_rules! __decl_store_items { // maps: // - pub // - $default - // so there are 4 cases here. - ($(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; - ($(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; // maps: // - pub // - $default - // so there are 4 cases here. - ($(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; - ($(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; // simple values without getters: // - pub // - $default - // so there are 4 cases here. - ($(#[$doc:meta])* $name:ident : $ty:ty; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident : $ty:ty; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident : $ty:ty; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; - ($(#[$doc:meta])* pub $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; // simple values with getters: // - pub // - $default - // so there are 4 cases here. - ($(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; - ($(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { - __decl_store_item!($name); __decl_store_items!($($t)*); - }; - ($(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { + ($(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { __decl_store_item!($name); __decl_store_items!($($t)*); }; @@ -2075,20 +1493,11 @@ macro_rules! __impl_store_fns { // maps: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) map $kty => $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) map $kty => $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty>; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) map $kty => $ty); __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty> = $default:expr; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) map $kty => $ty); __impl_store_fns!($traitinstance $($t)*); }; @@ -2097,37 +1506,21 @@ macro_rules! __impl_store_fns { // maps: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_fns!($traitinstance $($t)*); }; // maps: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn ($ty) map $kty => $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn ($ty) map $kty => $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn ($ty) map $kty => $ty); __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn ($ty) map $kty => $ty); __impl_store_fns!($traitinstance $($t)*); }; @@ -2136,20 +1529,11 @@ macro_rules! __impl_store_fns { // simple values with getters: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty>; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty>; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty>; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) $ty); __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty> = $default:expr; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn (Option<$ty>) $ty); __impl_store_fns!($traitinstance $($t)*); }; @@ -2158,37 +1542,21 @@ macro_rules! __impl_store_fns { // simple values without getters: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty; $($t:tt)*) => { - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty; $($t:tt)*) => { __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty; $($t:tt)*) => { - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_fns!($traitinstance $($t)*); }; // simple values with getters: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn ($ty) $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_fn!($traitinstance $name $getfn ($ty) $ty); - __impl_store_fns!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn ($ty) $ty); __impl_store_fns!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_fn!($traitinstance $name $getfn ($ty) $ty); __impl_store_fns!($traitinstance $($t)*); }; @@ -2218,20 +1586,11 @@ macro_rules! __impl_store_items { // maps: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; @@ -2239,20 +1598,11 @@ macro_rules! __impl_store_items { // maps: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; @@ -2260,20 +1610,11 @@ macro_rules! __impl_store_items { // simple values without getters: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident : $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; @@ -2281,20 +1622,11 @@ macro_rules! __impl_store_items { // simple values with getters: // - pub // - $default - // so there are 4 cases here. - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { - __impl_store_item!($name $traitinstance); - __impl_store_items!($traitinstance $($t)*); - }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; - ($traitinstance:ident $(#[$doc:meta])* pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { + ($traitinstance:ident $(#[$doc:meta])* $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty = $default:expr; $($t:tt)*) => { __impl_store_item!($name $traitinstance); __impl_store_items!($traitinstance $($t)*); }; @@ -2333,23 +1665,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident : - map $kty:ty => Option<$ty:ty> $(= $default:expr)*; - $( $t:tt )* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($kty, $ty); - $crate::storage::generator::StorageFunctionModifier::Optional - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident : + $pub:vis $name:ident : map $kty:ty => Option<$ty:ty> $(= $default:expr)*; $($t:tt)* ) => { @@ -2367,23 +1683,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident : - map $kty:ty => $ty:ty $(= $default:expr)*; - $( $t:tt )* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($kty, $ty); - $crate::storage::generator::StorageFunctionModifier::Default - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident : + $pub:vis $name:ident : map $kty:ty => $ty:ty $(= $default:expr)*; $($t:tt)* ) => { @@ -2402,23 +1702,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident get($getfn:ident) $(build($build:expr))* : - map $kty:ty => Option<$ty:ty> $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($kty, $ty); - $crate::storage::generator::StorageFunctionModifier::Optional - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident get($getfn:ident) $(build($build:expr))* : + $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => Option<$ty:ty> $(= $default:expr)*; $($t:tt)* ) => { @@ -2437,23 +1721,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident get($getfn:ident) $(build($build:expr))* : - map $kty:ty => $ty:ty $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($kty, $ty); - $crate::storage::generator::StorageFunctionModifier::Default - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident get($getfn:ident) $(build($build:expr))* : + $pub:vis $name:ident get($getfn:ident) $(build($build:expr))* : map $kty:ty => $ty:ty $(= $default:expr)*; $($t:tt)* ) => { @@ -2471,22 +1739,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident : Option<$ty:ty> $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($ty); - $crate::storage::generator::StorageFunctionModifier::Optional - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident : Option<$ty:ty> $(= $default:expr)*; + $pub:vis $name:ident : Option<$ty:ty> $(= $default:expr)*; $($t:tt)* ) => { __store_functions_to_metadata!( @@ -2502,22 +1755,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident : $ty:ty $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($ty); - $crate::storage::generator::StorageFunctionModifier::Default - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident : $ty:ty $(= $default:expr)*; + $pub:vis $name:ident : $ty:ty $(= $default:expr)*; $($t:tt)* ) => { __store_functions_to_metadata!( @@ -2535,23 +1773,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : - Option<$ty:ty> $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($ty); - $crate::storage::generator::StorageFunctionModifier::Optional - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : + $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : Option<$ty:ty> $(= $default:expr)*; $($t:tt)* ) => { @@ -2569,23 +1791,7 @@ macro_rules! __store_functions_to_metadata { ( $( $metadata:expr ),*; $(#[doc = $doc_attr:tt])* - $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : - $ty:ty $(= $default:expr)*; - $($t:tt)* - ) => { - __store_functions_to_metadata!( - $( $metadata, )* - __store_function_to_metadata!( - $( $doc_attr ),*; $name; __store_type_to_metadata!($ty); - $crate::storage::generator::StorageFunctionModifier::Default - ); - $( $t )* - ) - }; - ( - $( $metadata:expr ),*; - $(#[doc = $doc_attr:tt])* - pub $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : + $pub:vis $name:ident get($getfn:ident) $(config($($myname:ident)*))* $(build($build:expr))* : $ty:ty $(= $default:expr)*; $($t:tt)* ) => {