trait bound for deriving `NetworkBehaviour`
When deriving NetworkBehaviour on a struct with generics, not being able to include bounds in the resulting trait implementation forces the bounds to be added to the struct and not the impl only. This potentially generates a great deal of trait propagation (in behaviour composition, for example)
Maybe there is a way to do this but I don't seem to find it in the docs
@divagant-martian would you mind providing an example?
not being able to include bounds in the resulting trait implementation
I am not sure I follow. Why can you not add a bound to the trait implementation?
For example, the below compiles:
trait ToBeImplemented {}
trait SomeBound {}
struct Foo<T> {
something: T,
}
impl<T> ToBeImplemented for Foo<T> where T: SomeBound {}
@mxinden as I said, the problem is in the derivation of the NetworkBehaviour implementation. I don't understand what is your example trying to prove. That's exactly what I would like.. for the derived NetworkBehaviour impl
Ah, sorry I didn't read properly.
Maybe there is a way to do this but I don't seem to find it in the docs
I am not aware of such mechanism.
Got it. I'll check around how it's usually done in derive macros, and if possible implement it
Let me know if still an issue.
No longer an issue!