Crates.io | implements |
lib.rs | implements |
version | 0.10.0 |
source | src |
created_at | 2021-11-29 07:05:56.723889 |
updated_at | 2024-10-30 21:36:35.056793 |
description | Macro to answer the question: does it implement a trait? |
homepage | https://github.com/Wandalen/wTools/tree/master/module/core/implements |
repository | https://github.com/Wandalen/wTools/tree/master/module/core/implements |
max_upload_size | |
id | 489116 |
size | 16,753 |
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
.use implements::*;
dbg!( implements!( 13_i32 => Copy ) );
// < implements!( 13_i32 => Copy ) : true
dbg!( implements!( Box::new( 13_i32 ) => Copy ) );
// < implements!( 13_i32 => Copy ) : false
cargo add implements
git clone https://github.com/Wandalen/wTools
cd wTools
cargo run --example implements_trivial