-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Summary
When attempting to reproduce the code in the /examples/browser-webrtc
directory in a new cargo folder, the example breaks when:
libp2p = { path = "../../libp2p", ...
is replaced with:
libp2p = { version = "0.53.1", ...
Expected behavior
I would expect to be able to drop in the same version =
as the lib at path =
and compile without issue.
Actual behavior
Example doesn't compile when path=
replaced with version=
Relevant log output
error[E0599]: the method `map` exists for struct `Transport`, but its trait bounds were not satisfied
--> examples/browser-webrtc/src/main.rs:36:14
|
32 | Ok(webrtc::tokio::Transport::new(
| ________________-
33 | | id_keys.clone(),
34 | | webrtc::tokio::Certificate::generate(&mut thread_rng())?,
35 | | )
36 | | .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn))))
| | -^^^ method cannot be called on `Transport` due to unsatisfied trait bounds
| |_____________|
|
|
::: /rust-libp2p/transports/webrtc/src/tokio/transport.rs:49:1
|
49 | pub struct Transport {
| --------------------
| |
| doesn't satisfy `libp2p_webrtc::tokio::Transport: Iterator`
| doesn't satisfy `libp2p_webrtc::tokio::Transport: StreamExt`
| doesn't satisfy `libp2p_webrtc::tokio::Transport: futures::Stream`
|
= note: the following trait bounds were not satisfied:
`libp2p_webrtc::tokio::Transport: futures::Stream`
which is required by `libp2p_webrtc::tokio::Transport: StreamExt`
`&libp2p_webrtc::tokio::Transport: futures::Stream`
which is required by `&libp2p_webrtc::tokio::Transport: StreamExt`
`&mut libp2p_webrtc::tokio::Transport: futures::Stream`
which is required by `&mut libp2p_webrtc::tokio::Transport: StreamExt`
`libp2p_webrtc::tokio::Transport: Iterator`
which is required by `&mut libp2p_webrtc::tokio::Transport: Iterator`
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
3 + use libp2p_core::transport::Transport;
|
warning: unused import: `futures::StreamExt`
--> examples/browser-webrtc/src/main.rs:9:5
|
9 | use futures::StreamExt;
| ^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: unused import: `core::Transport`
--> examples/browser-webrtc/src/main.rs:12:5
|
12 | core::Transport,
| ^^^^^^^^^^^^^^^
Possible Solution
I'm a bit stumped, as libp2p::core
exports Transport
, so I'm not really sure what's going on or why the traits would have issues based on the source of the library. The compile error even goes so far as to say that core::Transport
is unused!
Version
0.53.1
Metadata
Metadata
Assignees
Labels
No labels