mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-23 16:11:19 +00:00
swarm-derive/: Add where clause of behaviour to generated out event (#2819)
When generating the `OutEvent` for a `NetworkBehaviour`, add the `where` clause of the `NetworkBehaviour` `struct` to the generated `enum`.
This commit is contained in:
parent
8dc0188a1d
commit
67266c6a66
@ -159,7 +159,9 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream {
|
||||
let visibility = &ast.vis;
|
||||
|
||||
Some(quote! {
|
||||
#visibility enum #name #impl_generics {
|
||||
#visibility enum #name #impl_generics
|
||||
#where_clause
|
||||
{
|
||||
#(#fields),*
|
||||
}
|
||||
})
|
||||
|
@ -272,7 +272,7 @@ fn custom_event_mismatching_field_names() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn where_clause() {
|
||||
fn bound() {
|
||||
#[allow(dead_code)]
|
||||
#[derive(NetworkBehaviour)]
|
||||
struct Foo<T: Copy + NetworkBehaviour> {
|
||||
@ -281,6 +281,19 @@ fn where_clause() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn where_clause() {
|
||||
#[allow(dead_code)]
|
||||
#[derive(NetworkBehaviour)]
|
||||
struct Foo<T>
|
||||
where
|
||||
T: Copy + NetworkBehaviour,
|
||||
{
|
||||
ping: libp2p::ping::Ping,
|
||||
bar: T,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_derives_with_import() {
|
||||
#[allow(dead_code)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user