assert-impl 0.1.0

Macro for static assert types implement a trait or not

Macro for static assert that types implement a trait or not.


Assuming you have the following definitions:

struct Nadeshiko;
struct Rin;
struct Chiaki;
struct Aoi;
struct Ena;

trait Yakuru {}
impl Yakuru for Nadeshiko {}
impl Yakuru for Chiaki {}
impl Yakuru for Aoi {}

This should build:

assert_impl!(Yakuru: Nadeshiko, Chiaki, Aoi);
assert_impl!(!Yakuru: Rin, Ena);

But this should fail to build:

assert_impl!(Yakuru: Rin);
assert_impl!(!Yakuru: Nadeshiko);