Macro static_assertions::assert_impl_all
source · [−]macro_rules! assert_impl_all {
($type:ty: $($trait:path),+ $(,)?) => { ... };
}
Expand description
Asserts that the type implements all of the given traits.
See assert_not_impl_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);