Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
improve decl_storage instance doc
  • Loading branch information
gui1117 committed Mar 21, 2019
commit b53b64d02417b88b2196b96d736622ccf48b630b
8 changes: 5 additions & 3 deletions srml/support/procedural/src/storage/transformation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ fn decl_storage_items(
}

impls.extend(quote! {
/// Instance trait implemented by all usable instance of the module.
pub trait #instantiable: 'static {
#const_impls
}
Expand All @@ -510,12 +511,12 @@ fn decl_storage_items(
.map(|i| {
let name = format!("Instance{}", i);
let ident = syn::Ident::new(&name, proc_macro2::Span::call_site());
(name, ident)
(name, ident, quote! {#[doc=r"Module instance"]})
})
.chain(default_instance.clone().map(|ident| (String::new(), ident)));
.chain(default_instance.clone().map(|ident| (String::new(), ident, quote! {#[doc=r"Default module instance"]})));

// Impl Instance trait for instances
for (prefix, ident) in instances {
for (prefix, ident, doc) in instances {
let mut const_impls = TokenStream2::new();

for (const_name, partial_const_value) in &const_names {
Expand All @@ -529,6 +530,7 @@ fn decl_storage_items(
// Those trait are derived because of wrong bounds for generics
#[cfg_attr(feature = "std", derive(Debug))]
#[derive(Clone, Eq, PartialEq, #scrate::codec::Encode, #scrate::codec::Decode)]
#doc
pub struct #ident;
impl #instantiable for #ident {
#const_impls
Expand Down