Void event type for connection limits and allow-block list behaviours. #3977
Replies: 4 comments 18 replies
-
Not to my knowledge. Ideally, we would use the Does it work if you let the derive macro auto-generate the enum? You'll have two |
Beta Was this translation helpful? Give feedback.
-
I see. You seem to prefer a separate third-party crate for such dependencies rather than reexported types.
We tend to have more control over events` names. It works either way. Thanks for the answers. |
Beta Was this translation helpful? Give feedback.
-
Right now |
Beta Was this translation helpful? Give feedback.
-
I just realized how we can fix your original issue @shamil-gadelshin ! We can extend the derive-macro to always generate the following impl if impl From<#derive_prelude::Void> for #out_event {
fn from(v: #derive_prelude::Void) -> Self {
void::unreachable(v)
}
} We will also have to add Are you open to send a PR? |
Beta Was this translation helpful? Give feedback.
-
Libp2p v0.51.3
When we use connection limits or allow-block list behaviours along with
#[behaviour(out_event = "Event")]
directive:we need to specify the
Void
type for the event:Otherwise, we get an error: the trait
std::convert::From<void::Void>
is not implemented forbehavior::Event
.It's confusing for a couple of reasons:
Is there a better option to work with events for connection limits or allow-block list behaviours?
Beta Was this translation helpful? Give feedback.
All reactions