Asserts that the type does not implement any of the given traits.
This macro causes a compilation failure if any of the provided individual
traits are implemented for the type. If you want to check that a combination
of traits is not implemented you should invoke
instead. For single traits both macros behave the same.
u32 were to implement
Into conversions for
usize and for
the following would fail to compile:
assert_not_impl_any!(u32: Into<usize>, Into<u8>);
This is also good for simple one-off cases:
assert_not_impl_any!(&'static mut u8: Copy);
The following example fails to compile since
u32 can be converted into
u64 even though it can not be converted into a
assert_not_impl_any!(u32: Into<u64>, Into<u16>);