mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 10:21:05 +00:00
Support pallet::storage conditional compilation (#8324)
* Support pallet::storage conditional compilation. * Add docs for cfg attributes. * Keep strong types for get cfg attrs return. * Update frame/support/procedural/src/pallet/parse/helper.rs * Update frame/support/procedural/src/pallet/parse/storage.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -1418,6 +1418,18 @@ pub mod pallet_prelude {
|
||||
/// pub(super) type MyStorage<T> = StorageMap<_, Blake2_128Concat, u32, u32>;
|
||||
/// ```
|
||||
///
|
||||
/// The optional attributes `#[cfg(..)]` allow conditional compilation for the storage.
|
||||
///
|
||||
/// E.g:
|
||||
/// ```ignore
|
||||
/// #[cfg(feature = "my-feature")]
|
||||
/// #[pallet::storage]
|
||||
/// pub(super) type MyStorage<T> = StorageValue<_, u32>;
|
||||
/// ```
|
||||
///
|
||||
/// All the `cfg` attributes are automatically copied to the items generated for the storage, i.e. the
|
||||
/// getter, storage prefix, and the metadata element etc.
|
||||
///
|
||||
/// NOTE: If the `QueryKind` generic parameter is still generic at this stage or is using some type
|
||||
/// alias then the generation of the getter might fail. In this case the getter can be implemented
|
||||
/// manually.
|
||||
|
||||
Reference in New Issue
Block a user