Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.md"
keywords = ["network","protocol","dds","rtps"]
license = "Apache-2.0"
edition = "2021"
rust-version = "1.73.0"
rust-version = "1.91.0"
homepage = "https://atostek.com/en/products/rustdds/"
repository = "https://github.com/Atostek/RustDDS"
categories = ["network-programming", "science::robotics"]
Expand Down Expand Up @@ -118,4 +118,4 @@ termion = "4.0.2"


[target.'cfg(target_os = "linux")'.dev-dependencies]
procfs = "0.17" # for ddsperf
procfs = "0.17" # for ddsperf
28 changes: 6 additions & 22 deletions src/discovery/discovery_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ fn move_by_guid_prefix<D>(
from: &mut BTreeMap<GUID, D>,
to: &mut BTreeMap<GUID, D>,
) {
let to_move: Vec<GUID> = from.range(guid_prefix.range()).map(|(g, _)| *g).collect();
for guid in to_move {
from.remove(&guid).map(|d| to.insert(guid, d));
}
let to_move = from.extract_if(guid_prefix.range(), |_, _| true);
to.extend(to_move);
}

pub(crate) fn discovery_db_read(
Expand Down Expand Up @@ -258,16 +256,9 @@ impl DiscoveryDB {
}

fn remove_topic_reader_with_prefix(&mut self, guid_prefix: GuidPrefix) {
// TODO: Implement this using .drain_filter() in BTreeMap once it lands in
// stable.
let to_remove: Vec<GUID> = self
let _ = self
.external_topic_readers
.range(guid_prefix.range())
.map(|(g, _)| *g)
.collect();
for guid in to_remove {
self.external_topic_readers.remove(&guid);
}
.extract_if(guid_prefix.range(), |_, _| true);
}

pub fn remove_topic_reader(&mut self, guid: GUID) {
Expand All @@ -286,16 +277,9 @@ impl DiscoveryDB {
}

fn remove_topic_writer_with_prefix(&mut self, guid_prefix: GuidPrefix) {
// TODO: Implement this using .drain_filter() in BTreeMap once it lands in
// stable.
let to_remove: Vec<GUID> = self
let _ = self
.external_topic_writers
.range(guid_prefix.range())
.map(|(g, _)| *g)
.collect();
for guid in to_remove {
self.external_topic_writers.remove(&guid);
}
.extract_if(guid_prefix.range(), |_, _| true);
}

pub fn remove_topic_writer(&mut self, guid: GUID) {
Expand Down
Loading