Cleanup rustdoc (#1965)

* Hide `__GetByteStruct*` types in the docs

* Forward documentation to `GenesisConfig`

* Hide `PhantomItem` in docs for `Call`

* Hide public calls in `Module`

* Forward documenation for storage functions

* Hide auxiliary functions in documentation
This commit is contained in:
Bastian Köcher
2019-03-11 21:49:37 +01:00
committed by GitHub
parent a3a5031d9d
commit 0ea90111b4
3 changed files with 65 additions and 36 deletions
+10 -5
View File
@@ -487,6 +487,7 @@ macro_rules! decl_module {
$vis:vis fn $name:ident ( root $(, $param:ident : $param_ty:ty )* ) { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
#[doc(hidden)]
$vis fn $name($( $param: $param_ty ),* ) -> $crate::dispatch::Result {
{ $( $impl )* }
Ok(())
@@ -503,6 +504,7 @@ macro_rules! decl_module {
) -> $result:ty { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
#[doc(hidden)]
$vis fn $name($( $param: $param_ty ),* ) -> $result {
$( $impl )*
}
@@ -518,6 +520,7 @@ macro_rules! decl_module {
) { $( $impl:tt )* }
) => {
impl<$trait_instance: $trait_name> $module<$trait_instance> {
#[doc(hidden)]
$vis fn $name(
$origin: $origin_ty $(, $param: $param_ty )*
) -> $crate::dispatch::Result {
@@ -608,10 +611,11 @@ macro_rules! decl_module {
#[cfg(feature = "std")]
$(#[$attr])*
pub enum $call_type<$trait_instance: $trait_name> {
#[doc(hidden)]
__PhantomItem(::std::marker::PhantomData<$trait_instance>),
__OtherPhantomItem(::std::marker::PhantomData<$trait_instance>),
$(
#[allow(non_camel_case_types)]
$(#[doc = $doc_attr])*
$fn_name ( $( $param ),* ),
)*
}
@@ -619,10 +623,11 @@ macro_rules! decl_module {
#[cfg(not(feature = "std"))]
$(#[$attr])*
pub enum $call_type<$trait_instance: $trait_name> {
#[doc(hidden)]
__PhantomItem(::core::marker::PhantomData<$trait_instance>),
__OtherPhantomItem(::core::marker::PhantomData<$trait_instance>),
$(
#[allow(non_camel_case_types)]
$(#[doc = $doc_attr])*
$fn_name ( $( $param ),* ),
)*
}
@@ -655,7 +660,6 @@ macro_rules! decl_module {
} else {
match *_other {
$call_type::__PhantomItem(_) => unreachable!(),
$call_type::__OtherPhantomItem(_) => unreachable!(),
_ => false,
}
}
@@ -698,7 +702,6 @@ macro_rules! decl_module {
fn encode_to<W: $crate::dispatch::Output>(&self, _dest: &mut W) {
$crate::__impl_encode!(_dest; *self; 0; $call_type; $( fn $fn_name( $( $(#[$codec_attr on type $param])* $param_name ),* ); )*);
if let $call_type::__PhantomItem(_) = *self { unreachable!() }
if let $call_type::__OtherPhantomItem(_) = *self { unreachable!() }
}
}
impl<$trait_instance: $trait_name> $crate::dispatch::Dispatchable
@@ -717,7 +720,7 @@ macro_rules! decl_module {
)
},
)*
_ => { panic!("__PhantomItem should never be used.") },
$call_type::__PhantomItem(_) => { panic!("__PhantomItem should never be used.") },
}
}
}
@@ -728,6 +731,7 @@ macro_rules! decl_module {
}
impl<$trait_instance: $trait_name> $mod_type<$trait_instance> {
#[doc(hidden)]
pub fn dispatch<D: $crate::dispatch::Dispatchable<Trait = $trait_instance>>(d: D, origin: D::Origin) -> $crate::dispatch::Result {
d.dispatch(origin)
}
@@ -944,6 +948,7 @@ macro_rules! __dispatch_impl_metadata {
$($rest:tt)*
) => {
impl<$trait_instance: $trait_name> $mod_type<$trait_instance> {
#[doc(hidden)]
pub fn call_functions() -> &'static [$crate::dispatch::FunctionMetadata] {
$crate::__call_to_functions!($($rest)*)
}