[][src]Macro static_assertions::assert_impl_all

macro_rules! assert_impl_all {
    ($type:ty: $($trait:path),+ $(,)?) => { ... };
}

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 impls.

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:

This example deliberately fails to compile
assert_impl_all!(*const u8: Send);