Release 0.2.4 #7
+16
-13
@@ -44,19 +44,22 @@ 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.
|
||||
/// 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<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()
|
||||
}
|
||||
|
||||
/// 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<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()
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user