static_assertions

Macro assert_trait_sub_all

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

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

Related:

§Examples

All types that implement Copy must implement Clone:

assert_trait_sub_all!(Copy: Clone);

All types that implement Ord must implement PartialEq, Eq, and PartialOrd:

assert_trait_sub_all!(Ord: PartialEq, Eq, PartialOrd);

The following example fails to compile because Eq is not required for PartialOrd:

assert_trait_sub_all!(PartialOrd: Eq);