mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 16:31:07 +00:00
Make sure docs given to decl_module! are passed to the module struct (#4526)
This commit is contained in:
committed by
Gavin Wood
parent
a45aa6e1b6
commit
f02e6d680a
@@ -1075,7 +1075,6 @@ macro_rules! decl_module {
|
||||
|
||||
// Declare a `Call` variant parameter that should be encoded `compact`.
|
||||
(@create_call_enum
|
||||
$( #[$attr:meta] )*
|
||||
$call_type:ident;
|
||||
<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path $(= $module_default_instance:path)?)?>
|
||||
{ $( $other_where_bounds:tt )* }
|
||||
@@ -1089,7 +1088,6 @@ macro_rules! decl_module {
|
||||
) => {
|
||||
$crate::decl_module! {
|
||||
@create_call_enum
|
||||
$( #[$attr] )*
|
||||
$call_type;
|
||||
<$trait_instance: $trait_name $(<I>, $instance: $instantiable $(= $module_default_instance)? )?>
|
||||
{ $( $other_where_bounds )* }
|
||||
@@ -1107,7 +1105,6 @@ macro_rules! decl_module {
|
||||
|
||||
// Declare a `Call` variant parameter.
|
||||
(@create_call_enum
|
||||
$( #[$attr:meta] )*
|
||||
$call_type:ident;
|
||||
<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path $(= $module_default_instance:path)?)?>
|
||||
{ $( $other_where_bounds:tt )* }
|
||||
@@ -1120,7 +1117,6 @@ macro_rules! decl_module {
|
||||
) => {
|
||||
$crate::decl_module! {
|
||||
@create_call_enum
|
||||
$( #[$attr] )*
|
||||
$call_type;
|
||||
<$trait_instance: $trait_name $(<I>, $instance: $instantiable $(= $module_default_instance)? )?>
|
||||
{ $( $other_where_bounds )* }
|
||||
@@ -1136,7 +1132,6 @@ macro_rules! decl_module {
|
||||
};
|
||||
|
||||
(@create_call_enum
|
||||
$( #[$attr:meta] )*
|
||||
$call_type:ident;
|
||||
<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path $(= $module_default_instance:path)?)?>
|
||||
{ $( $other_where_bounds:tt )* }
|
||||
@@ -1151,7 +1146,6 @@ macro_rules! decl_module {
|
||||
) => {
|
||||
$crate::decl_module! {
|
||||
@create_call_enum
|
||||
$( #[$attr] )*
|
||||
$call_type;
|
||||
<$trait_instance: $trait_name $(<I>, $instance: $instantiable $(= $module_default_instance)? )?>
|
||||
{ $( $other_where_bounds )* }
|
||||
@@ -1172,15 +1166,16 @@ macro_rules! decl_module {
|
||||
};
|
||||
|
||||
(@create_call_enum
|
||||
$( #[$attr:meta] )*
|
||||
$call_type:ident;
|
||||
<$trait_instance:ident: $trait_name:ident$(<I>, $instance:ident: $instantiable:path $(= $module_default_instance:path)?)?>
|
||||
{ $( $other_where_bounds:tt )* }
|
||||
{ $( $generated_variants:tt )* }
|
||||
{}
|
||||
) => {
|
||||
/// Dispatchable calls.
|
||||
///
|
||||
/// Each variant of this enum maps to a dispatchable function from the associated module.
|
||||
#[derive($crate::codec::Encode, $crate::codec::Decode)]
|
||||
$( #[$attr] )*
|
||||
pub enum $call_type<$trait_instance: $trait_name$(<I>, $instance: $instantiable $( = $module_default_instance)?)?>
|
||||
where $( $other_where_bounds )*
|
||||
{
|
||||
@@ -1221,6 +1216,7 @@ macro_rules! decl_module {
|
||||
|
||||
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, $crate::RuntimeDebug)]
|
||||
$( #[$attr] )*
|
||||
pub struct $mod_type<
|
||||
$trait_instance: $trait_name
|
||||
$(<I>, $instance: $instantiable $( = $module_default_instance)?)?
|
||||
@@ -1286,7 +1282,6 @@ macro_rules! decl_module {
|
||||
|
||||
$crate::decl_module! {
|
||||
@create_call_enum
|
||||
$( #[$attr] )*
|
||||
$call_type;
|
||||
<$trait_instance: $trait_name $(<I>, $instance: $instantiable $(= $module_default_instance)? )?>
|
||||
{ $( $other_where_bounds )* }
|
||||
|
||||
@@ -16,3 +16,20 @@
|
||||
|
||||
//! Test crate for frame_support. Allow to make use of `frame_support::decl_storage`.
|
||||
//! See tests directory.
|
||||
|
||||
// Make sure we fail compilation on warnings
|
||||
#![warn(missing_docs)]
|
||||
#![deny(warnings)]
|
||||
|
||||
/// The configuration trait
|
||||
pub trait Trait {
|
||||
/// The runtime origin type.
|
||||
type Origin;
|
||||
/// The block number type.
|
||||
type BlockNumber;
|
||||
}
|
||||
|
||||
frame_support::decl_module! {
|
||||
/// Some test module
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Substrate is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use frame_support::codec::{Encode, Decode, EncodeLike};
|
||||
|
||||
pub trait Trait: 'static + Eq + Clone {
|
||||
@@ -12,13 +28,11 @@ pub trait Trait: 'static + Eq + Clone {
|
||||
}
|
||||
|
||||
frame_support::decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
}
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
pub fn deposit_event(_event: impl Into<T::Event>) {
|
||||
}
|
||||
pub fn deposit_event(_event: impl Into<T::Event>) {}
|
||||
}
|
||||
|
||||
frame_support::decl_event!(
|
||||
|
||||
Reference in New Issue
Block a user