Move IsSubType and write some docs for the trait (#7350)

* Move `IsSubType` and write some docs for the trait

This moves the `IsSubType` trait from dispatch.rs to traits.rs. It also
adds docs to make the trait better understandable.

* Update frame/support/src/traits.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Bastian KöcherandShawn Tabrizi authored and GitHub committed 2020-10-19 08:24:13 +00:00
1 parent 74e8691aa8
commit 87c18598fc
7 files changed
+58 -16

No files matched your search

+1 -5
View File
@@ -1900,10 +1900,6 @@ macro_rules! decl_module {
}
}
pub trait IsSubType<T> {
fn is_sub_type(&self) -> Option<&T>;
}
/// Implement a meta-dispatch module to dispatch to other dispatchers.
#[macro_export]
macro_rules! impl_outer_dispatch {
@@ -2001,7 +1997,7 @@ macro_rules! impl_outer_dispatch {
}
$(
impl $crate::dispatch::IsSubType<$crate::dispatch::CallableCallFor<$camelcase, $runtime>> for $call_type {
impl $crate::traits::IsSubType<$crate::dispatch::CallableCallFor<$camelcase, $runtime>> for $call_type {
#[allow(unreachable_patterns)]
fn is_sub_type(&self) -> Option<&$crate::dispatch::CallableCallFor<$camelcase, $runtime>> {
match *self {