Macro to answer the question: does it implement a trait?
This solution has a limitation:
Fn
/FnMut
/FnOnce
which current entity does not implement you will get compile-time error instead of false
.This is alias for module::implements.
```rust use instance_of::*;
dbg!( instanceof!( 13i32 => Copy ) ); // < instanceof!( 13i32 => Copy ) : true dbg!( instanceof!( Box::new( 13i32 ) => Copy ) ); // < instanceof!( 13i32 => Copy ) : false ```
cargo add implements
git clone https://github.com/Wandalen/wTools
cd wTools
cd sample/rust/implements_trivial
cargo run