Skip to content
Discussion options

You must be logged in to vote

Your best bet is to branch on the existence of the registry and finish the builder so both branches of your match result in the same type. We do the same thing for our interop tests:

pub(crate) async fn build_swarm<B: NetworkBehaviour>(
ip: &str,
transport: Transport,
sec_protocol: Option<SecProtocol>,
muxer: Option<Muxer>,
behaviour_constructor: impl FnOnce(&Keypair) -> B,
) -> Result<(Swarm<B>, String)> {
let (swarm, addr) = match (transport, sec_protocol, muxer) {
(Transport::QuicV1, None, None) => (
libp2p::SwarmBuilder::with_new_identity()
.with_tokio()
.w…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gurinderu
Comment options

Answer selected by gurinderu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants