dtolnay / ghost

Define your own PhantomData

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support phantom void enum

L-as opened this issue · comments

Title.

I'm not sure what you mean. Could you give an example of the enum use case you have in mind?

Sorry for late reply, here's an example:

enum MyEnum<T> {}

Today this won't work since T isn't used. You can't use PhantomData here as easily, since you'd need to create a variant, which you don't want.

It is not currently implemented but the same technique would work. I would be prepared to consider a PR adding support for zero-variant enums.

Upon revisiting this, I think I'll leave this functionality to a different crate.