In the code below it looks like a trait is being implemented for the type called Module, but the statement does not start with impl. Why is this?
trait Store for Module<T: Trait> as TemplateModule {
/// The storage item for our proofs.
/// It maps a proof to the user who made the claim and when they made it.
Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
}
Actually yes it is. I guess that's the reason, but I don't understand how that works. Can you explain?
decl_storage! {
trait Store for Module<T: Trait> as TemplateModule {
/// The storage item for our proofs.
/// It maps a proof to the user who made the claim and when they made it.
Proofs: map hasher(blake2_128_concat) Vec<u8> => (T::AccountId, T::BlockNumber);
}
}
In general, macros can contain pretty much anything syntactically, even—well, IDK, how about Python code? It’s up to the macro definition that determines what kind of syntax is valid and how it’s translated into Rust code.
To find out more about how to use a specific macro, the best place to start looking is usually its documentation. (Unless it’s not well-documented of course...)