This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
decl_event!
should generate only one struct/type #4288
Closed
Description
Currently decl_event!
creates enum RawEvent
and type Event =
when you have a generic event, but for none-generic events it just generates enum Event
.
This needs to be unified, aka just generate enum Event
.
As rust automatic trait derives are somewhat broken, the macro will need to implementClone
, PartialEq
, Eq
and RuntimeDebug
on it's own. It is required that trait bound will not be put onto the generic parameter itself and instead it needs to be put onto the associated types, so something like this:
enum Event<T> {
SomeEvent(T::Data),
}
has the following PartialEq
bounds:
impl<T: Trait> PartialEq for Event<T> where T::Data: PartialEq
and not:
impl<T: Trait> PartialEq for Event<T> where T: PartialEq
parity-scale-codec
does this already automatic and so derive(Encode, Decode)
should work without any problems.
The code of the macro can be found here