Const Abc: Enum

#[repr(u8)]
pub enum Foo {
    A,
    B,
}

pub struct X_Texture<const Width: u32, const Height: u32, const Layers: u32, const Format: Foo> {
    inner: wgpu::Texture,
}

This code right now does not work since Foo is not a integers, bool, or char

For an enum T <-> u8, is there a way to use T as a generic constant ?

It's a bit janky with an enum, but here we are:

#[repr(u8)]
enum Foo {
    A,
    B
}

struct Bar<const N: u8>;

fn main(){ 
    let this = Bar::<{Foo::A as u8}>;
}

It also looks like you are trying to use a Typestate pattern, consider this:

use core::marker::PhantomData;

trait Foo {}
impl Foo for A {}
impl Foo for B {}

struct A;
struct B;

struct Bar<T: Foo> {
    _phantom: PhantomData<T>,
}

fn main() {
    let this = Bar {
        _phantom: PhantomData::<A>
    };
}