You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect macro to derive OutEvent enum automatically, as specified in doc
// If we find a #[behaviour(out_event = "Foo")] attribute on the
// struct, we set Foo as the out event. If not, the OutEvent is
// generated.
Actual behaviour
Compilation error
error[E0433]: failed to resolve: use of undeclared type `NetworkBehaviour`
--> src/main.rs:5:10
|
5 | #[derive(NetworkBehaviour)]
| ^^^^^^^^^^^^^^^^ use of undeclared type `NetworkBehaviour`
|
= note: this error originates in the derive macro `NetworkBehaviour` (in Nightly builds, run with -Z macro-backtrace for more info)
Debug Output
<output>
Possible Solution
Adding an out_event with a enum name yields no compilation errors.
Version
libp2p = "0.48.0"
libp2p-core = { version = "0.36.0", default-features = false, features = [ "secp256k1" ] }
libp2p-metrics = { version = "0.9.0", features = ["kad"] }
libp2p-noise = "0.39.0"
libp2p-swarm = "0.39.0"
$ rustup show
active toolchain
----------------
nightly-x86_64-apple-darwin (default)
$ cargo --version
cargo 1.65.0-nightly (4ed54cecc 2022-08-27)
Would you like to work on fixing this bug?
Maybe
The text was updated successfully, but these errors were encountered:
Thank you for the detailed bug report @folex!
I believe the issue is that when generating the out event the macro references the NetworkBehavourtrait, which you don't have imported:
Summary
The following snippet gives a compilation error
Here's a repo with that snippet, it reproduces the error on compilation https://github.com/folex/libp2p-network-behaviour-derive-error/tree/master
Expected behaviour
I expect macro to derive
OutEvent
enum automatically, as specified in docActual behaviour
Compilation error
Debug Output
Possible Solution
Adding an
out_event
with a enum name yields no compilation errors.Version
Would you like to work on fixing this bug?
Maybe
The text was updated successfully, but these errors were encountered: