2 releases
0.1.1 | Nov 29, 2019 |
---|---|
0.1.0 | Nov 29, 2019 |
#1648 in Development tools
8KB
60 lines
assert_bound
Simple rust lib for type assertions.
Examples
use assert_bound::assert_bound;
// assert that `()` implements Debug + Ord + PartialEq<()>
assert_bound!(() => std::fmt::Debug + Ord + PartialEq<()>);
// f32/f64 doesn't implement `Eq`, so rustc will
// fail to compile next line if it you uncomment it
// assert_bound!(0.1 => Eq);
lib.rs
:
When working with iterators/futures or other hign-generic types sometimes it's useful to assert
that type of some expression implements some traits or even cast smt to impl Trait
.
This crate provides macros for both goals — assert_bound
and as_opaque
.