macro_rules! assert_impl_any { ($x:ty: $($t:path),+ $(,)?) => { ... }; }
Expand description
Asserts that the type implements any of the given traits.
See assert_not_impl_any!
for achieving the opposite effect.
§Examples
u8
cannot be converted from u16
, but it can be converted into u16
:
assert_impl_any!(u8: From<u16>, Into<u16>);
The unit type cannot be converted from u8
or u16
, but it does implement
Send
:
assert_impl_any!((): From<u8>, From<u16>, Send);
The following example fails to compile because raw pointers do not implement
Send
or Sync
since they cannot be moved or shared between threads
safely:
ⓘ
assert_impl_any!(*const u8: Send, Sync);