mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-12 01:21:21 +00:00
Disambiguate calls to NetworkBehaviour::inject_event (#1543)
* Disambiguate calls to NetworkBehaviour::inject_event There is a gnarly edge-case with the custom-derive where rustc cannot disambiguate the call if: - The NetworkBehaviourEventProcess trait is imported - We nest NetworkBehaviours that use the custom-derive * Update misc/core-derive/src/lib.rs Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com> * Fix build and add CHANGELOG Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
@ -293,8 +293,8 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream {
|
||||
}
|
||||
|
||||
Some(match field.ident {
|
||||
Some(ref i) => quote!{ #elem => self.#i.inject_event(peer_id, connection_id, ev) },
|
||||
None => quote!{ #elem => self.#field_n.inject_event(peer_id, connection_id, ev) },
|
||||
Some(ref i) => quote!{ #elem => #trait_to_impl::inject_event(&mut self.#i, peer_id, connection_id, ev) },
|
||||
None => quote!{ #elem => #trait_to_impl::inject_event(&mut self.#field_n, peer_id, connection_id, ev) },
|
||||
})
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user