1 unstable release
0.1.0 | Jun 4, 2020 |
---|
#8 in #at
3KB
has_impl
Check if trait is implemented for type at compile time
Example
use has_impl::*;
trait Foo {}
impl Foo for i32 {}
fn main() {
assert_eq!(has_impl!(i32: Foo), true);
}
Installing
[dependencies]
has_impl = "0.1"
lib.rs
:
This crate provides has_impl!(type: Trait)
macro to check if Trait
is implemented for type
at complie time
use has_impl::*;
trait Foo {}
impl Foo for i32 {}
fn main() {
assert_eq!(has_impl!(i32: Foo), true);
}