macro_rules! assert_trait_sub_any { ($sub:path: $($super:path),+ $(,)?) => { ... }; }
Expand description
Asserts that the trait is a child of one or more of the other traits.
Related:
Examples
All types that implement Copy
must implement Clone
:
assert_trait_sub_any!(Copy: Clone);
All types that implement Ord
must implement Eq
, but don’t have to implement Clone
:
assert_trait_sub_any!(Ord: Eq, Clone);
The following example fails to compile because neither Eq
nor Clone
are required for
PartialOrd
:
ⓘ
assert_trait_sub_any!(PartialOrd: Eq, Clone);