Support for specialisation of trait
I would like to use enum_dispatch where I need to implement a concrete version of a generic trait. As far as I can tell it is not possible to achieve this at the moment.
My thought is that it would look something like this:
#[enum_dispatch]
trait Foo<A> {
fn rtn(&self) -> A;
}
struct SomeS;
struct FooA;
impl Foo<SomeS> for FooA {
fn rtn(&self) -> SomeS {
todo!()
}
}
struct FooB;
impl Foo<SomeS> for FooB {
fn rtn(&self) -> SomeS {
todo!()
}
}
#[enum_dispatch(Foo<SomeS>)]
enum FooEnum {
FooA(FooA)
FooB(FooB)
}
which would expand into
impl Foo<SomeS> for FooEnum {
fn rtn(&self) -> SomeS {
todo!()
}
}
Thank you for the library!