From 6b3b3ed2b5eb39d92e4e2b3bcce31ffdede77ea1 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Wed, 6 Feb 2019 15:45:19 +0100 Subject: [PATCH] Fix generics in out_event type in derive (#922) --- misc/core-derive/Cargo.toml | 2 +- misc/core-derive/src/lib.rs | 2 +- misc/core-derive/tests/test.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/core-derive/Cargo.toml b/misc/core-derive/Cargo.toml index 724f702c..b62aaa36 100644 --- a/misc/core-derive/Cargo.toml +++ b/misc/core-derive/Cargo.toml @@ -2,7 +2,7 @@ name = "libp2p-core-derive" edition = "2018" description = "Procedural macros of libp2p-core" -version = "0.3.1" +version = "0.3.2" authors = ["Parity Technologies "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/misc/core-derive/src/lib.rs b/misc/core-derive/src/lib.rs index 91758769..14660277 100644 --- a/misc/core-derive/src/lib.rs +++ b/misc/core-derive/src/lib.rs @@ -122,7 +122,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { match meta_item { syn::NestedMeta::Meta(syn::Meta::NameValue(ref m)) if m.ident == "out_event" => { if let syn::Lit::Str(ref s) = m.lit { - let ident: Ident = syn::parse_str(&s.value()).unwrap(); + let ident: syn::Type = syn::parse_str(&s.value()).unwrap(); out = quote!{#ident}; } } diff --git a/misc/core-derive/tests/test.rs b/misc/core-derive/tests/test.rs index a66d79a5..34270de6 100644 --- a/misc/core-derive/tests/test.rs +++ b/misc/core-derive/tests/test.rs @@ -145,7 +145,7 @@ fn custom_polling() { fn custom_event_no_polling() { #[allow(dead_code)] #[derive(NetworkBehaviour)] - #[behaviour(out_event = "String")] + #[behaviour(out_event = "Vec")] struct Foo { ping: libp2p::ping::Ping, identify: libp2p::identify::Identify,