I have code similar to the following:
fn f1<const B: bool>(x:u64) { }
fn f2<const B: bool>(x:u64) {
match B {
true => f1::<false>(x),
false => f1::<true>(x),
}
}
That is, I need to negate a const bool in function calls. Rust currently doesn't support something as plain as f1::<!B>() unfortunately. Is there a better way for me to do this other than to litter match statements everywhere?
If this is just one function, I would create a function:
If more, you can create a macro. The following macro works only for bare identifiers (
foo(), notfoo::bar()) and one generic parameter, extending it is difficult but possible: