You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: proc-macro/src/lib.rs
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,58 @@ use synstructure::{
30
30
Structure,
31
31
};
32
32
33
+
/// Register type sizes for [EventsDecoder](struct.EventsDecoder.html) and set the `MODULE`.
34
+
///
35
+
/// The `module` macro registers the type sizes of the associated types of a trait so that [EventsDecoder](struct.EventsDecoder.html)
36
+
/// can decode events of that type when received from Substrate. It also sets the `MODULE` constant
37
+
/// to the name of the trait (must match the name of the Substrate pallet) that enables the [Call](), [Event]() and [Store]() macros to work.
38
+
///
39
+
/// If you do not want an associated type to be registered, likely because you never expect it as part of a response payload to be decoded, use `#[module(ignore)]` on the type.
40
+
///
41
+
/// Example:
42
+
///
43
+
/// ```ignore
44
+
/// #[module]
45
+
/// pub trait Herd: Husbandry {
46
+
/// type Hooves: HoofCounter;
47
+
/// type Wool: WoollyAnimal;
48
+
/// #[module(ignore)]
49
+
/// type Digestion: EnergyProducer + std::fmt::Debug;
50
+
/// }
51
+
/// ```
52
+
///
53
+
/// The above will produce the following code:
54
+
///
55
+
/// ```ignore
56
+
/// pub trait Herd: Husbandry {
57
+
/// type Hooves: HoofCounter;
58
+
/// type Wool: WoollyAnimal;
59
+
/// #[module(ignore)]
60
+
/// type Digestion: EnergyProducer + std::fmt::Debug;
0 commit comments