-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libp2p_swarm_derive: Add crate
parameter to configure libp2p
crate name
#3006
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,23 @@ fn custom_event() { | |
} | ||
} | ||
|
||
#[test] | ||
fn custom_crate() { | ||
use libp2p as mylibp2p; | ||
#[allow(dead_code)] | ||
#[derive(NetworkBehaviour)] | ||
#[behaviour(crate = "mylibp2p")] | ||
struct Foo { | ||
ping: ping::Behaviour, | ||
identify: identify::Behaviour, | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn foo() { | ||
require_net_behaviour::<Foo>(); | ||
} | ||
} | ||
Comment on lines
+136
to
+151
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test also already passes with current master (if you remove line 141). I think it is only a problem if the crate is imported in the
I am not against adding this parameter, but could we add a test that fails on current master and would be fixed with this? 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I understand, the issue is not clashing symbols but renaming the crate in your manifest. To test that, we'd have to make a separate test crate with a renamed import. This make me wonder, should we perhaps just require certain symbols to be present for the macro to work? That would make #3023 easier to implement. Or perhaps we could make a seperate "derive" prelude? Like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually, don't worry about it, I already have a solution to that. |
||
|
||
#[test] | ||
fn custom_event_mismatching_field_names() { | ||
#[allow(dead_code)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly the same as the logic for
out_event
, right? What do you think of moving it into a function called in both places?