diff --git a/swarm-test/CHANGELOG.md b/swarm-test/CHANGELOG.md index 98027fcbea2..9f1e2baa913 100644 --- a/swarm-test/CHANGELOG.md +++ b/swarm-test/CHANGELOG.md @@ -1,10 +1,13 @@ +## 0.4.1 + +- Add `#[track_caller]` to `SwarmExt` methods + ## 0.4.0 ## 0.3.0 - ## 0.2.0 - Raise MSRV to 1.65. diff --git a/swarm-test/src/lib.rs b/swarm-test/src/lib.rs index 48f5bcbf4ef..85e1f3a209b 100644 --- a/swarm-test/src/lib.rs +++ b/swarm-test/src/lib.rs @@ -52,6 +52,7 @@ pub trait SwarmExt { /// This will take addresses from the `other` [`Swarm`] via [`Swarm::external_addresses`]. /// By default, this iterator will not yield any addresses. /// To add listen addresses as external addresses, use [`ListenFuture::with_memory_addr_external`] or [`ListenFuture::with_tcp_addr_external`]. + #[track_caller] async fn connect(&mut self, other: &mut Swarm) where T: NetworkBehaviour + Send, @@ -63,9 +64,11 @@ pub trait SwarmExt { /// This function only abstracts away the "dial and wait for `ConnectionEstablished` event" part. /// /// Because we don't have access to the other [`Swarm`], we can't guarantee that it makes progress. + #[track_caller] async fn dial_and_wait(&mut self, addr: Multiaddr) -> PeerId; /// Wait for specified condition to return `Some`. + #[track_caller] async fn wait(&mut self, predicate: P) -> E where P: Fn(SwarmEvent<::ToSwarm>) -> Option, @@ -79,11 +82,13 @@ pub trait SwarmExt { /// Returns the next [`SwarmEvent`] or times out after 10 seconds. /// /// If the 10s timeout does not fit your usecase, please fall back to `StreamExt::next`. + #[track_caller] async fn next_swarm_event(&mut self) -> SwarmEvent<::ToSwarm>; /// Returns the next behaviour event or times out after 10 seconds. /// /// If the 10s timeout does not fit your usecase, please fall back to `StreamExt::next`. + #[track_caller] async fn next_behaviour_event(&mut self) -> ::ToSwarm; async fn loop_on_next(self);