Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 33 additions & 36 deletions srml/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,12 +487,10 @@ macro_rules! decl_module {
$(#[doc = $doc_attr:tt])*
$vis:vis fn $name:ident ( root $(, $param:ident : $param_ty:ty )* ) { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
$(#[doc = $doc_attr])*
$vis fn $name($( $param: $param_ty ),* ) -> $crate::dispatch::Result {
{ $( $impl )* }
Ok(())
}
$(#[doc = $doc_attr])*
$vis fn $name($( $param: $param_ty ),* ) -> $crate::dispatch::Result {
{ $( $impl )* }
Ok(())
}
};

Expand All @@ -505,11 +503,9 @@ macro_rules! decl_module {
root $(, $param:ident : $param_ty:ty )*
) -> $result:ty { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
$(#[doc = $doc_attr])*
$vis fn $name($( $param: $param_ty ),* ) -> $result {
$( $impl )*
}
$(#[doc = $doc_attr])*
$vis fn $name($( $param: $param_ty ),* ) -> $result {
$( $impl )*
}
};

Expand All @@ -522,14 +518,12 @@ macro_rules! decl_module {
$origin:ident $(, $param:ident : $param_ty:ty )*
) { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
$(#[doc = $doc_attr])*
$vis fn $name(
$origin: $origin_ty $(, $param: $param_ty )*
) -> $crate::dispatch::Result {
{ $( $impl )* }
Ok(())
}
$(#[doc = $doc_attr])*
$vis fn $name(
$origin: $origin_ty $(, $param: $param_ty )*
) -> $crate::dispatch::Result {
{ $( $impl )* }
Ok(())
}
};

Expand All @@ -542,11 +536,9 @@ macro_rules! decl_module {
$origin:ident $(, $param:ident : $param_ty:ty )*
) -> $result:ty { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
$(#[doc = $doc_attr])*
$vis fn $name($origin: $origin_ty $(, $param: $param_ty )* ) -> $result {
$( $impl )*
}
$(#[doc = $doc_attr])*
$vis fn $name($origin: $origin_ty $(, $param: $param_ty )* ) -> $result {
$( $impl )*
}
};

Expand Down Expand Up @@ -601,18 +593,23 @@ macro_rules! decl_module {
$( $deposit_event )*
}

$(
decl_module! {
@impl_function
$mod_type<$trait_instance: $trait_name>;
$origin_type;
$from;
$(#[doc = $doc_attr])*
$fn_vis fn $fn_name (
$from $(, $param_name : $param )*
) $( -> $result )* { $( $impl )* }
}
)*
/// Can also be called using [`Call`].
///
/// [`Call`]: enum.Call.html
impl<$trait_instance: $trait_name> $mod_type<$trait_instance> {
$(
decl_module! {
@impl_function
$mod_type<$trait_instance: $trait_name>;
$origin_type;
$from;
$(#[doc = $doc_attr])*
$fn_vis fn $fn_name (
$from $(, $param_name : $param )*
) $( -> $result )* { $( $impl )* }
}
)*
}

#[cfg(feature = "std")]
$(#[$attr])*
Expand Down
4 changes: 4 additions & 0 deletions srml/support/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ macro_rules! __decl_generic_event {
{ $( $events:tt )* };
{ ,$( $generic_param:ident = $generic_type:ty ),* };
) => {
/// [`RawEvent`] specialized for the configuration [`Trait`]
///
/// [`RawEvent`]: enum.RawEvent.html
/// [`Trait`]: trait.Trait.html
pub type Event<$event_generic_param> = RawEvent<$( $generic_type ),*>;
// Workaround for https://github.com/rust-lang/rust/issues/26925 . Remove when sorted.
#[derive(Clone, PartialEq, Eq, $crate::codec::Encode, $crate::codec::Decode)]
Expand Down