Macro typenum::cmp [−][src]
macro_rules! cmp {
($a : ident < $b : ty) => { ... };
($a : ty, < $b : ty) => { ... };
($a : ident == $b : ty) => { ... };
($a : ty, == $b : ty) => { ... };
($a : ident > $b : ty) => { ... };
($a : ty, > $b : ty) => { ... };
($a : ident <= $b : ty) => { ... };
($a : ty, <= $b : ty) => { ... };
($a : ident != $b : ty) => { ... };
($a : ty, != $b : ty) => { ... };
($a : ident >= $b : ty) => { ... };
($a : ty, >= $b : ty) => { ... };
}👎 Deprecated since 1.9.0:
use the op! macro instead
Expand description
A convenience macro for comparing type numbers. Use op! instead.
Due to the intricacies of the macro system, if the left-hand operand is more complex than a simple
ident, you must place a comma between it and the comparison sign.
For example, you can do cmp!(P5 > P3) or cmp!(typenum::P5, > typenum::P3) but not
cmp!(typenum::P5 > typenum::P3).
The result of this comparison will always be one of True (aka B1) or False (aka B0).
Example
#[macro_use] extern crate typenum;
use typenum::consts::*;
use typenum::Bit;
fn main() {
type Result = cmp!(P9 == op!(P1 + P2 * (P2 - N2)));
assert_eq!(Result::to_bool(), true);
}