Skip to content

Commit 6edd6dc

Browse files
committed
Replace RelayMap::extend() member fn with RelayMap::join
Signed-off-by: Matthias Beyer <[email protected]>
1 parent a17b61e commit 6edd6dc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

iroh-relay/src/relay_map.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,14 @@ impl RelayMap {
112112
self.relays.write().expect("poisoned").remove(url)
113113
}
114114

115-
/// Extends this `RelayMap` with another one.
116-
pub fn extend(&self, other: &RelayMap) {
117-
let mut a = self.relays.write().expect("poisoned");
118-
let b = other.relays.read().expect("poisoned");
119-
a.extend(b.iter().map(|(a, b)| (a.clone(), b.clone())));
115+
/// Joins this `RelayMap` with another one into a new one
116+
pub fn join(self, other: RelayMap) -> RelayMap {
117+
{
118+
let mut a = self.relays.write().expect("poisoned");
119+
let b = other.relays.read().expect("poisoned");
120+
a.extend(b.iter().map(|(a, b)| (a.clone(), b.clone())));
121+
}
122+
self
120123
}
121124
}
122125

0 commit comments

Comments
 (0)