logo
macro_rules! assert_trait_super_all {
    ($super:path: $($sub:path),+ $(,)?) => { ... };
}
Expand description

Asserts that the trait is a parent of all of the other traits.

Related:

Examples

With this, traits A and B can both be tested to require Copy on a single line:

trait A: Copy {}
trait B: Copy {}

assert_trait_super_all!(Copy: A, B);

Otherwise, each sub-trait would require its own call to assert_trait_sub_all!:

assert_trait_sub_all!(A: Copy);
assert_trait_sub_all!(B: Copy);

The following example fails to compile because trait C does not require Copy:

trait C {}

assert_trait_super_all!(Copy: A, B, C);