Allow where bounds on decl_module! and decl_storage! (#3000)

* Introduces a `where` bound to `decl_macro!` and `decl_storage!`

* More fixes

* Adds documentation
This commit is contained in:
Bastian Köcher
2019-07-03 21:07:39 +02:00
committed by GitHub
parent 5dc8792d8f
commit e9864b94a3
6 changed files with 328 additions and 99 deletions
@@ -139,6 +139,14 @@ use proc_macro::TokenStream;
/// Accessing the structure no requires the instance as generic parameter:
/// * `Foo::<I>` if the value type is not generic
/// * `Foo::<T, I>` if the value type is generic
///
/// ## Where clause
///
/// This macro supports a where clause which will be replicated to all generated types.
///
/// ```nocompile
/// trait Store for Module<T: Trait> as Example where T::AccountId: std::fmt::Display {}
/// ```
#[proc_macro]
pub fn decl_storage(input: TokenStream) -> TokenStream {
storage::transformation::decl_storage_impl(input)