How to match all const generics value when writing `impl`

I may not make my self clear, but the example is simple:

struct Foo<const A: bool, const B: bool> {

}

impl Foo<*, true> {
    pub fn test() {
        println!("b: true")
    }
}

impl Foo<*, false> {
    pub fn test() {
        println!("b: false")
    }
}

In the code, I want to match all types that B is true, no matter what value A is. Anyway to do that?

Did you try impl<const A: bool> Foo<A, true> {?

3 Likes

What a shame, I didn't even thinking about this :rofl: