Closed hobofan closed 2 years ago
The example above does not make sense for a final draft. I used it in the other case to showcase how it does not work, but it does not make sense after all.
It should look something like this:
#[derive(Delegate)]
#[delegate(DiscreteSquareRootProtocol<T>)]
struct WrapperProtocol<T>(PhantomData<T>, FastSqrt);
or maybe even this:
#[derive(Delegate)]
#[delegate(DiscreteSquareRootProtocol<u32>)]
struct WrapperProtocol(FastSqrt);
The example above does not make sense for a final draft. I used it in the other case to showcase how it does not work, but it does not make sense after all.
It should look something like this:
#[derive(Delegate)] #[delegate(DiscreteSquareRootProtocol<T>)] struct WrapperProtocol<T>(PhantomData<T>, FastSqrt);
or maybe even this:
#[derive(Delegate)] #[delegate(DiscreteSquareRootProtocol<u32>)] struct WrapperProtocol(FastSqrt);
+1 for this syntax!
I wanted to note that there is actually two forms of generic traits that would need support here.
#[delegate]
annotation.Generics on a trait method level. Those should be handled automatically IMO and always be forwarded. At the moment, that doesn't seem to work.
Probably just an edge case, that needs to be fixed, not a whole new feature, no?
Generics on a trait method level. Those should be handled automatically IMO and always be forwarded. At the moment, that doesn't seem to work.
Probably just an edge case, that needs to be fixed, not a whole new feature, no?
Yes exactly. That is what I meant with "those should be handled automatically" :)
See @Cydhra's comment (https://github.com/hobofan/ambassador/issues/15#issuecomment-574470105):