Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/libcollections/vec_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ impl<V> VecMap<V> {
VecMap { v: Vec::with_capacity(capacity) }
}

/// Returns the number of elements the `VecMap` can hold without
/// reallocating.
///
/// # Example
///
/// ```
/// use std::collections::VecMap;
/// let map: VecMap<String> = VecMap::with_capacity(10);
/// assert!(map.capacity() >= 10);
/// ```
#[inline]
#[unstable = "matches collection reform specification, waiting for dust to settle"]
pub fn capacity(&self) -> uint {
self.v.capacity()
}

/// Returns an iterator visiting all keys in ascending order by the keys.
/// The iterator's element type is `uint`.
#[unstable = "matches collection reform specification, waiting for dust to settle"]
Expand Down