Skip to content

Why Cant I Derive Network Behaviour For A Struct? #6253

@0x20CB

Description

@0x20CB

Summary

Hello,

I am implementing a struct for NetworkBehaviour and can not derive it using the implemented version for deriving network behaviour.

#[derive(NetworkBehaviour)]
pub struct MuscarineBehaviour {
    autonat_client: libp2p::autonat::v2::client::Behaviour,

    // Ping (P2P)
    //pub ping: PingBehaviour,

    // PubSub
    gossipsub: libp2p::gossipsub::Behaviour,
    floodsub: libp2p::floodsub::Behaviour,

    // Identify
    identify: libp2p::identify::Behaviour,
    
    // Peer Routing
    kademlia: libp2p::kad::Behaviour<MemoryStore>,

    // Relay
    relay_server: libp2p::relay::Behaviour,
    //request_response: RequestResponseBehaviour<FileExchangeCodec>,
}

Expected behavior

I expected it to derive network behaviour and not throw an error.

Actual behavior

It threw an error while deriving network behaviour

Relevant log output

expected Poll<ToSwarm<<MuscarineBehaviour as NetworkBehaviour>::ToSwarm, <<MuscarineBehaviour as NetworkBehaviour>::ConnectionHandler as ConnectionHandler>::FromBehaviour>>, found Poll<ToSwarm<MuscarineBehaviourEvent, Either<Either<Either<Either<Either<Either<DialRequest, Infallible>, {unknown}>, {unknown}>, {unknown}>, {unknown}>, {unknown}>>>

Possible Solution

Unknown

Version

0.56.0

Would you like to work on fixing this bug?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions