diff --git a/src/collections/raw_array.rs b/src/collections/raw_array.rs index 93fa6d7b25f5a2bcae741b1716e6087deb2e2982..6773f70e26ca5d08a298111c3a4ef0c8ba3f41cb 100644 --- a/src/collections/raw_array.rs +++ b/src/collections/raw_array.rs @@ -67,8 +67,8 @@ impl RawArray { return self.data; } - /// Returns the length of the array. - pub fn len(&self) -> usize { + /// Returns the capacity of the array. + pub fn cap(&self) -> usize { return self.count; } @@ -118,7 +118,7 @@ mod tests { #[test] fn drop_empty_array() { let array = RawArray::::new(); - assert_eq!(array.len(), 0); + assert_eq!(array.cap(), 0); assert_eq!(array.data(), ptr::null_mut()); } @@ -133,7 +133,7 @@ mod tests { for grow_idx in 0..NUM_RESIZES { let new_size = INIT_SIZE + grow_idx * 4; array.resize(new_size); - assert_eq!(array.len(), new_size); + assert_eq!(array.cap(), new_size); } check(&array, INIT_SIZE); @@ -149,7 +149,7 @@ mod tests { fill(&mut array, INIT_SIZE); for _idx in 0..NUM_RESIZES { array.resize(INIT_SIZE); - assert_eq!(array.len(), INIT_SIZE); + assert_eq!(array.cap(), INIT_SIZE); } check(&array, INIT_SIZE); } @@ -177,7 +177,7 @@ mod tests { fill(&mut array, max_size); for size in sizes { array.resize(size); - assert_eq!(array.len(), size); + assert_eq!(array.cap(), size); } check(&array, min_size); }