I'd like to have a private enum as an implementation detail of my library, but provide a public method (on another type) that returns its kind. However, it seems enum-kinds always copies the visibility of the original enum.
For example:
#[derive(EnumKind)]
#[enum_kind(FooKind)]
enum Foo {
A(u32),
B(u64),
}
pub fn get_a_foo() -> FooKind {
Foo::A(0).into()
}
This produces:
error[E0446]: private type `FooKind` in public interface
--> src/lib.rs:36:1
|
29 | #[derive(EnumKind)]
| -------- `FooKind` declared as private
...
36 | pub fn get_a_foo() -> FooKind {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
I'd like to have a private enum as an implementation detail of my library, but provide a public method (on another type) that returns its kind. However, it seems enum-kinds always copies the visibility of the original enum.
For example:
This produces: