pub async fn creat_kademlia_network() -> Result<(), Box<dyn Error>> {
let local_key = identity::Keypair::generate_ed25519();
let public_key = local_key.public();
let local_peer_id = PeerId::from_public_key(&public_key);
let mut store = MemoryStore::new(local_peer_id);
let kademlia = Kademlia::new(local_peer_id, store);
#[derive(NetworkBehaviour)]
struct Behaviour {
kademlia: Kademlia<MemoryStore>,
}
let behaviour: Behaviour = Behaviour { kademlia };
let transport = development_transport(local_key).await?;
let mut swarm =
SwarmBuilder::with_async_std_executor(transport, behaviour, local_peer_id).build();
Ok(())
}
When I write this codes, it reminds me that enter image description here
How should I solve it plz? and I insert the #[derive(NetworkBehaviour)]
But it does not work!