Fix core-derive (#707)

This commit is contained in:
Pierre Krieger 2018-11-29 18:01:16 +01:00 committed by GitHub
parent fceaf2293b
commit 179e65ff5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -107,7 +107,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream {
additional.push(quote!{#substream_generic: ::libp2p::tokio_io::AsyncWrite});
if let Some(where_clause) = where_clause {
Some(quote!{#where_clause, #(#additional),*})
Some(quote!{#where_clause #(#additional),*})
} else {
Some(quote!{where #(#additional),*})
}

View File

@ -73,8 +73,7 @@ fn three_fields() {
}
}
// TODO: fix this example ; a Rust bug prevent us from doing so
/*#[test]
#[test]
fn event_handler() {
#[allow(dead_code)]
#[derive(NetworkBehaviour)]
@ -86,7 +85,7 @@ fn event_handler() {
impl<TSubstream: libp2p::tokio_io::AsyncRead + libp2p::tokio_io::AsyncWrite> Foo<TSubstream> {
// TODO: for some reason, the parameter cannot be `PeriodicIdentifyBehaviourEvent` or we
// get a compilation error ; figure out why or open an issue to Rust
fn foo(&mut self, ev: <libp2p::identify::PeriodicIdentifyBehaviour<TSubstream> as libp2p::core::swarm::NetworkBehaviour>::OutEvent) {
fn foo<TTopology>(&mut self, ev: <libp2p::identify::PeriodicIdentifyBehaviour<TSubstream> as libp2p::core::swarm::NetworkBehaviour<TTopology>>::OutEvent) {
let libp2p::identify::PeriodicIdentifyBehaviourEvent::Identified { .. } = ev;
}
}
@ -94,7 +93,7 @@ fn event_handler() {
fn foo<TSubstream: libp2p::tokio_io::AsyncRead + libp2p::tokio_io::AsyncWrite>() {
require_net_behaviour::<Foo<TSubstream>>();
}
}*/
}
#[test]
fn custom_polling() {