-
Notifications
You must be signed in to change notification settings - Fork 957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
swarm-derive/: Add where clause of behaviour to generated out event #2819
Conversation
When generating the `OutEvent` for a `NetworkBehaviour`, add the `where` clause of the `NetworkBehaviour` `struct` to the generated `enum`.
Won't this cause an error in case of #[derive(NetworkBehaviour)]
struct Foo<T>
where
T: Copy
{
ping: libp2p::ping::Ping,
#[behaviour(ignore)]
bar: T,
} which will generate pub enum FooEvent<T> // Error: unused Parameter
where
T: Copy
{
Ping(<libp2p::ping::Ping as NetworkBehaviour>::OutEvent)
} Am I missing something? |
@elenaf9 that is correct. Good catch. Though why would someone use the Once we remove With that in mind, I would leave this as is. Do you agree @elenaf9? |
I am a bit confused. Why would we not need
@mxinden what am I missing here? |
Let me rephrase: With With the removal of Can you think of a use case for |
Thanks for elaborating @mxinden! Makes sense now.
I guess the only use case is if the wrapping
Yep :) |
Description
When generating the
OutEvent
for aNetworkBehaviour
, add thewhere
clause of theNetworkBehaviour
struct
to the generatedenum
.Links to any relevant issues
Follow up to #2792
Open Questions
Change checklist