macro_rules! assert_impl_all { ($ty:ty: $($traits:path),+ $(,)?) => { ... }; }
Expand description
Asserts that the type implements all of the given traits.
See assert_impl_not_all!
for achieving the opposite effect.
Examples
This can be used to ensure types implement auto traits such as Send
and
Sync
, as well as traits with blanket impl
s.
assert_impl_all!(u32: Copy, Send);
assert_impl_all!(&str: Into<String>);
The following example fails to compile because raw pointers do not implement
Send
since they cannot be moved between threads safely:
ⓘ
assert_impl_all!(*const u8: Send);