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 dfa8f8f0df - Show all commits
+24 -4
View File
@@ -23,8 +23,18 @@ impl<V: Copy, T: Clone> VertexMap<V, T> {
self.capacity()
}
/// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with
/// the default value.
///
/// 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);
}
#[deprecated(since = "0.2.4", note = "use 'extend(graph.vertex_capacity())' instead")]
pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) {
self.inner.resize(graph.vertex_capacity());
self.inner.extend(graph.vertex_capacity());
}
}
@@ -63,8 +73,18 @@ impl<E: Copy, T: Clone> EdgeMap<E, T> {
self.capacity()
}
/// Extends the internal data storage of the map to `capacity`, pre-filling any new slots with
/// the default value.
///
/// 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);
}
#[deprecated(since = "0.2.4", note = "use 'extend(graph.edge_capacity())' instead")]
pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) {
self.inner.resize(graph.edge_capacity());
self.inner.extend(graph.edge_capacity());
}
}
@@ -101,8 +121,8 @@ impl<E: Copy, T: Clone> EntityMap<E, T> {
self.data.len()
}
pub fn resize(&mut self, capacity: usize) {
if capacity > self.data.len() {
pub fn extend(&mut self, capacity: usize) {
if capacity > self.data.capacity() {
self.data.resize(capacity, self.default.clone());
}
}