Make decl_event! more ergonomic (#723)

* Improve and simplify `decl_event!`

- RawEvent is not required anymore to be written in the defintion
- Events with and without parameters are now supported everywhere

* Make `decl_event!` more flexible with the automatic naming of generic parameters

The macro will now automatically derive the name of a generic parameter
from the trait type name, if no explicit name is given.

`where Balance = <T as Trait>::Balance` can be simplified to
`where <T as Trait>::Balance`.

* Adapts to latest refactoring changes
This commit is contained in:
Bastian Köcher
2018-09-12 16:02:59 +02:00
committed by Gav Wood
parent 4685018991
commit c5c5b35da3
11 changed files with 236 additions and 95 deletions
+2 -4
View File
@@ -151,8 +151,7 @@ mod tests {
}
decl_event!(
pub enum Event<T> with RawEvent<Balance>
where <T as Trait>::Balance
pub enum Event<T> where <T as Trait>::Balance
{
/// Hi, I am a comment.
TestEvent(Balance),
@@ -179,8 +178,7 @@ mod tests {
}
decl_event!(
pub enum Event<T> with RawEvent<Balance>
where <T as Trait>::Balance
pub enum Event<T> where <T as Trait>::Balance
{
TestEvent(Balance),
}