From 242aba09e86903a3f627fd5753e3cdbc3bfe8057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Fri, 31 Jul 2026 09:32:52 +0200 Subject: [PATCH] Rename VertexMap/EdgeMap::extend to "expand" This avoids the naming conflict with e.g. Vec::extend --- src/maps.rs | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/maps.rs b/src/maps.rs index f827d87..baf8cf8 100644 --- a/src/maps.rs +++ b/src/maps.rs @@ -44,19 +44,22 @@ impl VertexMap { self.capacity() } - /// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with - /// the default value. + /// Expands the internal data storage capacity of the map to `capacity`. Does nothing if + /// capacity is already sufficient. /// /// Use this before writing data for new graph vertices to avoid incremental growth on the first /// write to each new vertex. - pub fn extend(&mut self, capacity: usize) { - self.inner.extend(capacity); + pub fn expand(&mut self, capacity: usize) { + self.inner.expand(capacity); } - #[deprecated(since = "0.2.4", note = "use 'extend(graph.vertex_capacity())' instead")] + #[deprecated( + since = "0.2.4", + note = "use 'expand(graph.vertex_capacity())' instead" + )] #[allow(missing_docs)] pub fn sync>(&mut self, graph: &G) { - self.inner.extend(graph.vertex_capacity()); + self.inner.expand(graph.vertex_capacity()); } } @@ -111,19 +114,19 @@ impl EdgeMap { self.capacity() } - /// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with - /// the default value. + /// Expands the internal data storage capacity of the map to `capacity`. Does nothing if + /// capacity is already sufficient. /// /// Use this before writing data for new graph edges to avoid incremental growth on the first /// write to each new edge. - pub fn extend(&mut self, capacity: usize) { - self.inner.extend(capacity); + pub fn expand(&mut self, capacity: usize) { + self.inner.expand(capacity); } - #[deprecated(since = "0.2.4", note = "use 'extend(graph.edge_capacity())' instead")] + #[deprecated(since = "0.2.4", note = "use 'expand(graph.edge_capacity())' instead")] #[allow(missing_docs)] pub fn sync>(&mut self, graph: &G) { - self.inner.extend(graph.edge_capacity()); + self.inner.expand(graph.edge_capacity()); } } @@ -160,7 +163,7 @@ impl EntityMap { self.data.len() } - pub fn extend(&mut self, capacity: usize) { + pub fn expand(&mut self, capacity: usize) { if capacity > self.data.capacity() { self.data.resize(capacity, self.default.clone()); }