[][src]Macro static_assertions::assert_trait_super_all

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

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



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:

This example deliberately fails to compile
trait C {}

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