Replace VertexMap/EdgeMap.len with capacity
Rename EdgeMap.len to capacity. Add VertexMap.capacity and EdgeMap.capacity. Deprecate VertexMap.len and EdgeMap.len.
This commit is contained in:
+17
-6
@@ -13,11 +13,17 @@ impl<V: Copy, T: Clone> VertexMap<V, T> {
|
||||
}
|
||||
}
|
||||
|
||||
// Reads beyond len() are valid and return the default value.
|
||||
pub fn len(&self) -> usize {
|
||||
self.inner.len()
|
||||
// Reads beyond 'capacity' are valid and return the default value.
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.inner.capacity()
|
||||
}
|
||||
|
||||
#[deprecated(since = "0.2.2", note = "use 'capacity' instead")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.capacity()
|
||||
}
|
||||
|
||||
|
||||
pub fn sync<G: GraphTopology<Vertex = V>>(&mut self, graph: &G) {
|
||||
self.inner.resize(graph.vertex_capacity());
|
||||
}
|
||||
@@ -48,9 +54,14 @@ impl<E: Copy, T: Clone> EdgeMap<E, T> {
|
||||
}
|
||||
}
|
||||
|
||||
// Reads beyond len() are valid and return the default value.
|
||||
// Reads beyond 'capacity' are valid and return the default value.
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.inner.capacity()
|
||||
}
|
||||
|
||||
#[deprecated(since = "0.2.2", note = "use 'capacity' instead")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.inner.len()
|
||||
self.capacity()
|
||||
}
|
||||
|
||||
pub fn sync<G: GraphTopology<Edge = E>>(&mut self, graph: &G) {
|
||||
@@ -87,7 +98,7 @@ impl<E: Copy, T: Clone> EntityMap<E, T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.data.len()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user