Macro static_assertions::assert_impl
[−]
[src]
macro_rules! assert_impl { ($x:ty, $($t:path),+ $(,)*) => { ... }; ($label:ident; $($xs:tt)+) => { ... }; }
Asserts at compile-time that the type implements the given traits.
Examples
Can be used to ensure types implement Send
, Sync
, and other traits:
assert_impl!(str; String, Send, Sync, From<&'static str>); assert_impl!(vec; &'static [u8], Into<Vec<u8>>); fn main() { // Produces a compilation failure: // `*const u8` cannot be sent between threads safely // assert_impl!(*const u8, Send); }