Release 0.2.4 #7

Merged
warrence merged 19 commits from release-0.2.4 into main 2026-07-31 09:38:27 +02:00
Showing only changes of commit 242aba09e8 - Show all commits
+16 -13
View File
@@ -44,19 +44,22 @@ impl<V: Copy, T: Clone> VertexMap<V, T> {
self.capacity() self.capacity()
} }
/// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with /// Expands the internal data storage capacity of the map to `capacity`. Does nothing if
/// the default value. /// capacity is already sufficient.
/// ///
/// Use this before writing data for new graph vertices to avoid incremental growth on the first /// Use this before writing data for new graph vertices to avoid incremental growth on the first
/// write to each new vertex. /// write to each new vertex.
pub fn extend(&mut self, capacity: usize) { pub fn expand(&mut self, capacity: usize) {
self.inner.extend(capacity); 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)] #[allow(missing_docs)]
pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) { pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) {
self.inner.extend(graph.vertex_capacity()); self.inner.expand(graph.vertex_capacity());
} }
} }
@@ -111,19 +114,19 @@ impl<E: Copy, T: Clone> EdgeMap<E, T> {
self.capacity() self.capacity()
} }
/// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with /// Expands the internal data storage capacity of the map to `capacity`. Does nothing if
/// the default value. /// capacity is already sufficient.
/// ///
/// Use this before writing data for new graph edges to avoid incremental growth on the first /// Use this before writing data for new graph edges to avoid incremental growth on the first
/// write to each new edge. /// write to each new edge.
pub fn extend(&mut self, capacity: usize) { pub fn expand(&mut self, capacity: usize) {
self.inner.extend(capacity); 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)] #[allow(missing_docs)]
pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) { pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) {
self.inner.extend(graph.edge_capacity()); self.inner.expand(graph.edge_capacity());
} }
} }
@@ -160,7 +163,7 @@ impl<E: Copy, T: Clone> EntityMap<E, T> {
self.data.len() self.data.len()
} }
pub fn extend(&mut self, capacity: usize) { pub fn expand(&mut self, capacity: usize) {
if capacity > self.data.capacity() { if capacity > self.data.capacity() {
self.data.resize(capacity, self.default.clone()); self.data.resize(capacity, self.default.clone());
} }