Fix generics in out_event type in derive (#922)

This commit is contained in:
Pierre Krieger 2019-02-06 15:45:19 +01:00 committed by GitHub
parent a22121c8e7
commit 6b3b3ed2b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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 <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"

View File

@ -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};
}
}

View File

@ -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<String>")]
struct Foo<TSubstream> {
ping: libp2p::ping::Ping<TSubstream>,
identify: libp2p::identify::Identify<TSubstream>,